patch-2.4.8 linux/include/asm-s390/idals.h

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

diff -u --recursive --new-file v2.4.7/linux/include/asm-s390/idals.h linux/include/asm-s390/idals.h
@@ -10,36 +10,51 @@
 #include <linux/config.h>
 #include <asm/irq.h>
 
-typedef unsigned long idaw_t;
+#define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
+#define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
 
-static inline idaw_t *
+static inline addr_t *
 idal_alloc ( int nridaws )
 {
 	if ( nridaws > 33 )
 		BUG();
-	return kmalloc(nridaws * sizeof(idaw_t), GFP_ATOMIC | GFP_DMA );
+	return kmalloc(nridaws * sizeof(addr_t), GFP_ATOMIC | GFP_DMA );
 }
 
 static inline void 
-idal_free ( idaw_t *idal )
+idal_free ( addr_t *idal )
 {
 	kfree (idal);
 }
 
+#if defined(CONFIG_ARCH_S390X)
+extern unsigned long __create_idal(unsigned long address, int count);
+#endif
+
 /*
  * Function: set_normalized_cda
  * sets the address of the data in CCW
  * if necessary it allocates an IDAL and sets sthe appropriate flags
  */
-#if defined (CONFIG_ARCH_S390X)
-extern void set_normalized_cda(ccw1_t * ccw, unsigned long address);
-#else
-static inline void
+static inline int
 set_normalized_cda(ccw1_t * ccw, unsigned long address)
 {
-	ccw->cda = address;
-}
+	int ret = 0;
+
+#if defined (CONFIG_ARCH_S390X)
+	if (((address + ccw->count) >> 31) != 0) {
+		if (ccw->flags & CCW_FLAG_IDA)
+			BUG();
+		address = __create_idal(address, ccw->count);
+		if (address)
+			ccw->flags |= CCW_FLAG_IDA;
+		else
+			ret = -ENOMEM;
+	}
 #endif
+	ccw->cda = (__u32) address;
+	return ret;
+}
 
 /*
  * Function: clear_normalized_cda
@@ -48,10 +63,12 @@
 static inline void
 clear_normalized_cda ( ccw1_t * ccw ) 
 {
+#if defined(CONFIG_ARCH_S390X)
 	if ( ccw -> flags & CCW_FLAG_IDA ) {
-		idal_free ( (idaw_t *) (ccw -> cda ));
+		idal_free ( (addr_t *)(unsigned long) (ccw -> cda ));
 		ccw -> flags &= ~CCW_FLAG_IDA;
 	}
+#endif
 	ccw -> cda = 0;
 }
 

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