patch-2.3.14 linux/include/asm-alpha/core_cia.h

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

diff -u --recursive --new-file v2.3.13/linux/include/asm-alpha/core_cia.h linux/include/asm-alpha/core_cia.h
@@ -39,17 +39,15 @@
 
 /* CIA ADDRESS BIT DEFINITIONS
  *
- *  3 3 3 3|3 3 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 
- *  9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |1| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |0|0|0|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
- *  |                                                                        \_/ \_/
- *  |                                                                         |   |
- *  +-- IO space, not cached.                                   Byte Enable --+   |
- *                                                              Transfer Length --+
- *
- *
+ *  3333 3333 3322 2222 2222 1111 1111 11 
+ *  9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
+ *  ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ *  1                                             000
+ *  ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ *  |                                             |\|
+ *  |                               Byte Enable --+ |
+ *  |                             Transfer Length --+
+ *  +-- IO space, not cached
  *
  *   Byte      Transfer
  *   Enable    Length    Transfer  Byte    Address
@@ -77,14 +75,25 @@
 #define CIA_MEM_R2_MASK 0x07ffffff  /* SPARSE Mem region 2 mask is 27 bits */
 #define CIA_MEM_R3_MASK 0x03ffffff  /* SPARSE Mem region 3 mask is 26 bits */
 
-#define CIA_DMA_WIN_BASE_DEFAULT	(1024*1024*1024)
-#define CIA_DMA_WIN_SIZE_DEFAULT	(1024*1024*1024)
+#define CIA_DMA_WIN_BASE_DEFAULT	(1UL*1024*1024*1024)
+#define CIA_DMA_WIN_SIZE_DEFAULT	(2UL*1024*1024*1024)
+
+/* Window 0 at 1GB size 1GB mapping to 0.  */
+#define CIA_DMA_WIN0_BASE_DEFAULT      (1UL*1024*1024*1024)
+#define CIA_DMA_WIN0_SIZE_DEFAULT      (1UL*1024*1024*1024)
+#define CIA_DMA_WIN0_TRAN_DEFAULT      (0UL)
+
+/* Window 1 at 2GB size 1GB mapping to 1GB.  */
+#define CIA_DMA_WIN1_BASE_DEFAULT      (2UL*1024*1024*1024)
+#define CIA_DMA_WIN1_SIZE_DEFAULT      (1UL*1024*1024*1024)
+#define CIA_DMA_WIN1_TRAN_DEFAULT      (1UL*1024*1024*1024)
+
 
 #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
 #define CIA_DMA_WIN_BASE		alpha_mv.dma_win_base
 #define CIA_DMA_WIN_SIZE		alpha_mv.dma_win_size
 #else
-#define CIA_DMA_WIN_BASE		CIA_DMA_WIN_SIZE_DEFAULT
+#define CIA_DMA_WIN_BASE		CIA_DMA_WIN_BASE_DEFAULT
 #define CIA_DMA_WIN_SIZE		CIA_DMA_WIN_SIZE_DEFAULT
 #endif
 
@@ -393,6 +402,15 @@
 {
 	unsigned long mask, base;
 
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+		addr += CIA_DENSE_MEM;
+	}
+#endif
+
+	addr -= CIA_DENSE_MEM;
 	if (addr >= alpha_mv.sm_base_r1
 	    && addr <= alpha_mv.sm_base_r1 + CIA_MEM_R1_MASK) {
 		mask = CIA_MEM_R1_MASK;
@@ -411,7 +429,8 @@
 	else
 	{
 #if 0
-		printk("cia: address 0x%lx not covered by HAE\n", addr);
+		printk(KERN_CRIT "cia: address 0x%lx not covered by HAE\n",
+		       addr);
 #endif
 		return 0;
 	}
@@ -445,8 +464,9 @@
 
 __EXTERN_INLINE void cia_srm_writeb(unsigned char b, unsigned long addr)
 {
-	unsigned long work = cia_srm_base(addr), w;
-	if (work) {
+	unsigned long work, w;
+
+	if ((work = cia_srm_base(addr)) != 0) {
 		work += 0x00;	/* add transfer length */
 		w = __kernel_insbl(b, addr & 3);
 		*(vuip) work = w;
@@ -455,8 +475,10 @@
 
 __EXTERN_INLINE void cia_srm_writew(unsigned short b, unsigned long addr)
 {
-	unsigned long work = cia_srm_base(addr), w;
-	if (work) {
+	unsigned long work, w;
+
+	addr -= CIA_DENSE_MEM;
+	if ((work = cia_srm_base(addr)) != 0) {
 		work += 0x08;	/* add transfer length */
 		w = __kernel_inswl(b, addr & 3);
 		*(vuip) work = w;
@@ -467,6 +489,15 @@
 {
 	unsigned long result, msb;
 
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	/* Note that CIA_DENSE_MEM has no bits not masked in these 
+	   operations, so we don't have to subtract it back out.  */
 	msb = addr & 0xE0000000;
 	addr &= CIA_MEM_R1_MASK;
 	set_hae(msb);
@@ -479,6 +510,15 @@
 {
 	unsigned long result, msb;
 
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	/* Note that CIA_DENSE_MEM has no bits not masked in these 
+	   operations, so we don't have to subtract it back out.  */
 	msb = addr & 0xE0000000;
 	addr &= CIA_MEM_R1_MASK;
 	set_hae(msb);
@@ -489,8 +529,17 @@
 
 __EXTERN_INLINE void cia_writeb(unsigned char b, unsigned long addr)
 {
-        unsigned long msb, w; 
+	unsigned long msb, w; 
+
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
 
+	/* Note that CIA_DENSE_MEM has no bits not masked in these 
+	   operations, so we don't have to subtract it back out.  */
 	msb = addr & 0xE0000000;
 	addr &= CIA_MEM_R1_MASK;
 	set_hae(msb);
@@ -501,8 +550,17 @@
 
 __EXTERN_INLINE void cia_writew(unsigned short b, unsigned long addr)
 {
-        unsigned long msb, w; 
+	unsigned long msb, w; 
 
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	/* Note that CIA_DENSE_MEM has no bits not masked in these 
+	   operations, so we don't have to subtract it back out.  */
 	msb = addr & 0xE0000000;
 	addr &= CIA_MEM_R1_MASK;
 	set_hae(msb);
@@ -513,29 +571,60 @@
 
 __EXTERN_INLINE unsigned long cia_readl(unsigned long addr)
 {
-	return *(vuip) (addr + CIA_DENSE_MEM);
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	return *(vuip)addr;
 }
 
 __EXTERN_INLINE unsigned long cia_readq(unsigned long addr)
 {
-	return *(vulp) (addr + CIA_DENSE_MEM);
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	return *(vulp)addr;
 }
 
 __EXTERN_INLINE void cia_writel(unsigned int b, unsigned long addr)
 {
-	*(vuip) (addr + CIA_DENSE_MEM) = b;
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	*(vuip)addr = b;
 }
 
 __EXTERN_INLINE void cia_writeq(unsigned long b, unsigned long addr)
 {
-	*(vulp) (addr + CIA_DENSE_MEM) = b;
+#if __DEBUG_IOREMAP
+	if (addr <= 0x100000000) {
+		printk(KERN_CRIT "cia: 0x%lx not ioremapped (%p)\n",
+		       addr, __builtin_return_address(0));
+	}
+#endif
+
+	*(vulp)addr = b;
 }
 
-/* Find the DENSE memory area for a given bus address.  */
+__EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr)
+{
+	return CIA_DENSE_MEM + addr;
+}
 
-__EXTERN_INLINE unsigned long cia_dense_mem(unsigned long addr)
+__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
 {
-	return CIA_DENSE_MEM;
+	return addr >= IDENT_ADDR + 0x8000000000UL;
 }
 
 #undef vip
@@ -569,7 +658,8 @@
 #define __readq		cia_readq
 #define __writel	cia_writel
 #define __writeq	cia_writeq
-#define dense_mem	cia_dense_mem
+#define __ioremap	cia_ioremap
+#define __is_ioaddr	cia_is_ioaddr
 
 #define inb(port) \
 (__builtin_constant_p((port))?__inb(port):_inb(port))
@@ -584,10 +674,12 @@
 #define inl(port)	__inl(port)
 #define outl(x,port)	__outl((x),(port))
 
-#define readl(a)	__readl((unsigned long)(a))
-#define readq(a)	__readq((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_readl(a)		__readl((unsigned long)(a))
+#define __raw_readq(a)		__readq((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)