patch-2.3.14 linux/include/asm-alpha/core_tsunami.h
Next file: linux/include/asm-alpha/io.h
Previous file: linux/include/asm-alpha/core_t2.h
Back to the patch index
Back to the overall index
- Lines: 227
- Date:
Mon Aug 16 10:33:58 1999
- Orig file:
v2.3.13/linux/include/asm-alpha/core_tsunami.h
- Orig date:
Sun Jan 10 09:59:59 1999
diff -u --recursive --new-file v2.3.13/linux/include/asm-alpha/core_tsunami.h linux/include/asm-alpha/core_tsunami.h
@@ -16,8 +16,24 @@
*
*/
-#define TSUNAMI_DMA_WIN_BASE_DEFAULT (1024*1024*1024U)
-#define TSUNAMI_DMA_WIN_SIZE_DEFAULT (1024*1024*1024U)
+/*
+ * We must actually use 2 windows to direct-map the 2GB space, because
+ * of an "idiot-syncracy" of the CYPRESS chip used on DS20 and others.
+ * It may respond to a PCI bus address in the last 1MB of the 4GB
+ * address range, and that is where real memory may appear.
+ *
+ * Sigh...
+ */
+#define TSUNAMI_DMA_WIN_BASE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN_SIZE_DEFAULT (2UL*1024*1024*1024)
+
+#define TSUNAMI_DMA_WIN0_BASE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN0_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN0_TRAN_DEFAULT (0UL)
+
+#define TSUNAMI_DMA_WIN1_BASE_DEFAULT (2UL*1024*1024*1024)
+#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
@@ -142,7 +158,7 @@
unsigned perror_v_rsvd2 : 1;
unsigned perror_v_cmd : 4;
unsigned perror_v_syn : 8;
- } perror_r_bits;
+ } perror_r_bits;
int perror_q_whole [2];
};
@@ -162,7 +178,7 @@
unsigned wsba_v_rsvd1 : 17;
unsigned wsba_v_addr : 12;
unsigned wsba_v_rsvd2 : 32;
- } wsba_r_bits;
+ } wsba_r_bits;
int wsba_q_whole [2];
};
@@ -256,7 +272,7 @@
unsigned perrmask_v_cre : 1;
unsigned perrmask_v_rsvd1 : 20;
unsigned perrmask_v_rsvd2 : 32;
- } perrmask_r_bits;
+ } perrmask_r_bits;
int perrmask_q_whole [2];
};
@@ -353,55 +369,118 @@
* Memory functions. all accesses are done through linear space.
*/
+__EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr)
+{
+ return XADDR + TSUNAMI_MEM(XHOSE);
+}
+
+__EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
+{
+ return addr >= IDENT_ADDR+TS_BIAS;
+}
+
__EXTERN_INLINE unsigned long tsunami_readb(unsigned long addr)
{
- return __kernel_ldbu(*(vucp)(XADDR + TSUNAMI_MEM(XHOSE)));
+#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)
{
- return __kernel_ldwu(*(vusp)(XADDR + TSUNAMI_MEM(XHOSE)));
+#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)
{
- return *(vuip)(XADDR + TSUNAMI_MEM(XHOSE));
+#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)
{
- return *(vulp)(XADDR + TSUNAMI_MEM(XHOSE));
+#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)
{
- __kernel_stb(b, *(vucp)(XADDR + TSUNAMI_MEM(XHOSE)));
- mb();
+#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)
{
- __kernel_stw(b, *(vusp)(XADDR + TSUNAMI_MEM(XHOSE)));
- mb();
+#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)
{
- *(vuip)(XADDR + TSUNAMI_MEM(XHOSE)) = b;
- mb();
+#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)
{
- *(vulp)(XADDR + TSUNAMI_MEM(XHOSE)) = b;
- mb();
-}
-
-/* Find the DENSE memory area for a given bus address. */
+#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
-__EXTERN_INLINE unsigned long tsunami_dense_mem(unsigned long addr)
-{
- return TSUNAMI_MEM(XHOSE);
+ *(vulp)addr = b;
}
#undef vucp
@@ -431,7 +510,8 @@
#define __readq tsunami_readq
#define __writel tsunami_writel
#define __writeq tsunami_writeq
-#define dense_mem tsunami_dense_mem
+#define __ioremap tsunami_ioremap
+#define __is_ioaddr tsunami_is_ioaddr
#define inb(port) __inb((port))
#define inw(port) __inw((port))
@@ -441,15 +521,16 @@
#define outw(v, port) __outw((v),(port))
#define outl(v, port) __outl((v),(port))
-#define readb(a) __readb((unsigned long)(a))
-#define readw(a) __readw((unsigned long)(a))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-
-#define writeb(v,a) __writeb((v),(unsigned long)(a))
-#define writew(v,a) __writew((v),(unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#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_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)