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

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

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/s390/idals.c linux/drivers/s390/idals.c
@@ -9,71 +9,36 @@
  */
 
 #include <linux/malloc.h>
+
 #include <asm/irq.h>
 #include <asm/idals.h>
-#include <asm/spinlock.h>
-
-#ifdef PRINTK_HEADER
-#undef PRINTK_HEADER
-#endif
-#define PRINTK_HEADER "idals:"
-
-/* a name template for the cache-names */
-static char idal_name_template[] = "idalcache-\0\0\0\0"; /* fill name with zeroes! */
-/* the cache's names */
-static char idal_cache_name[IDAL_NUMBER_CACHES][sizeof(idal_name_template)+1]; 
-/* the caches itself*/
-static kmem_cache_t *idal_cache[IDAL_NUMBER_CACHES]; 
 
-void
-free_idal ( ccw1_t *cp )
+#ifdef CONFIG_ARCH_S390X
+void 
+set_normalized_cda ( ccw1_t * cp, unsigned long address )
 {
+	int nridaws;
 	idaw_t *idal;
-	unsigned long upper2k,lower2k;
-	int nridaws,cacheind;
-	if ( cp -> flags & CCW_FLAG_IDA ) {
-		idal = cp -> cda;
-		lower2k = *idal & 0xfffffffffffff800;
-		upper2k = (*idal  + cp -> count - 1) & 0xfffffffffffff800;
-		nridaws = ((upper2k - lower2k) >> 11) + 1;
-		for ( cacheind = 0; (1 << cacheind) < nridaws ; cacheind ++ );
-		kmem_cache_free ( idal_cache[cacheind], idal );
-	}
-}
-
-int 
-idal_support_init ( void ) 
-{
-	int rc=0;
-	int cachind;
-	
-	for ( cachind = 0; cachind < IDAL_NUMBER_CACHES; cachind ++ ) {
-		int slabsize = 8 << cachind;
-		sprintf ( idal_cache_name[cachind], 
-			  "%s%d%c", idal_name_template, slabsize, 0);
-		idal_cache[cachind] = kmem_cache_create( idal_cache_name[cachind], 
-							 slabsize, 0,
-							 SLAB_HWCACHE_ALIGN | SLAB_DMA, 
-							 NULL, NULL );
-		if ( ! idal_cache [cachind] ) {
-			printk (KERN_WARNING PRINTK_HEADER "Allocation of IDAL cache failed\n");
-		}
-	}
-	
-	return rc;
-}
+        int count = cp->count;
 
-void idal_support_cleanup ( void )
-{
-	int cachind;
-
-	/* Shrink the caches, if available */
-	for ( cachind = 0; cachind < IDAL_NUMBER_CACHES; cachind ++ ) {
-		if ( idal_cache[cachind] ) {
-			if ( kmem_cache_shrink(idal_cache[cachind]) == 0 ) {
-				idal_cache[cachind] = NULL;
-			}
-		}
+	if (cp->flags & CCW_FLAG_IDA)
+		BUG();
+	if (((address + count) >> 31) == 0)
+		cp -> cda = address;
+		return;
+        nridaws = ((address & 2047L) + count + 2047L) >> 11;
+	idal = idal_alloc(nridaws);
+	if ( idal == NULL ) {
+		/* probably we should have a fallback here */
+		panic ("Cannot allocate memory for IDAL\n");
 	}
-
+	cp->flags |= CCW_FLAG_IDA;
+	cp->cda = (__u32)(unsigned long)(idaw_t *)idal;
+        do {
+		*idal++ = address;
+		address = (address & -2048L) + 2048;
+		nridaws --;
+        } while ( nridaws > 0 );
+	return;
 }
+#endif

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