patch-2.4.4 linux/drivers/s390/idals.c

Next file: linux/drivers/s390/misc/Makefile
Previous file: linux/drivers/s390/char/tubttysiz.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.3/linux/drivers/s390/idals.c linux/drivers/s390/idals.c
@@ -9,6 +9,7 @@
    * 12/13/00 changed IDALs to 4kByte-IDALs
  */
 
+#include <linux/module.h>
 #include <linux/config.h>
 #include <linux/malloc.h>
 
@@ -16,6 +17,8 @@
 #include <asm/idals.h>
 
 #ifdef CONFIG_ARCH_S390X
+#define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
+#define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
 void 
 set_normalized_cda ( ccw1_t * cp, unsigned long address )
 {
@@ -25,11 +28,12 @@
 
 	if (cp->flags & CCW_FLAG_IDA)
 		BUG();
-	if (((address + count) >> 31) == 0) { /* do we really need  '+count'? */
+	if (((address + count) >> 31) == 0) { 
 		cp -> cda = address;
 		return;
 	}
-        nridaws = ((address & 4095L) + count + 4095L) >> 12;
+        nridaws = ((address & (IDA_BLOCK_SIZE-1)) + count + 
+		   (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
 	idal = idal_alloc(nridaws);
 	if ( idal == NULL ) {
 		/* probably we should have a fallback here */
@@ -39,9 +43,12 @@
 	cp->cda = (__u32)(unsigned long)(idaw_t *)idal;
         do {
 		*idal++ = address;
-		address = (address & -4096L) + 4096;
+		address = (address & -(IDA_BLOCK_SIZE)) + (IDA_BLOCK_SIZE);
 		nridaws --;
         } while ( nridaws > 0 );
 	return;
 }
+
+EXPORT_SYMBOL (set_normalized_cda);
+
 #endif

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