Resent-Date: Tue, 13 Oct 1998 16:02:31 +0200 (MET DST)
Date: Tue, 13 Oct 1998 16:02:18 +0200
From: Kars de Jong <jongk@cs.utwente.nl>
To: linux-m68k@lists.linux-m68k.org
Subject: Still that strange IDE problem in 2.1.124
Resent-From: linux-m68k@phil.uni-sb.de

Hi all,

I decided to try the now standard include/asm-m68k/ide.h file again, still no
luck. Here's what I get:

Searching for SAVEKMSG magic...
Found 1487 bytes at 0x001e0008
>>>>>>>>>>>>>>>>>>>>
Linux version 2.1.124 (root@rincewind) (gcc version 2.7.2.3) #1 Tue Oct 13 01:38:02 CEST 1998
Amiga hardware found: [A1200] VIDEO BLITTER AUDIO FLOPPY A1200_IDE KEYBOARD MOUSE SERIAL PARALLEL A2000_CLK CHIP_RAM PAULA LISA ALICE_PAL PCMCIA ZORRO 
Console: colour dummy device 80x25
Calibrating delay loop... 99.74 BogoMIPS
Memory: 46992k/48640k available (724k kernel code, 876k data, 48k init)
kmem_create: Forcing size word alignment - vm_area_struct
kmem_create: Forcing size word alignment - filp
POSIX conformance testing by UNIFIX
Zorro: Probing AutoConfig expansion devices: 1 device
Swansea University Computer Society NET3.039 for Linux 2.1
kmem_create: Forcing size word alignment - sock
kmem_create: Forcing size word alignment - skbuff_head_cache
NET3: Unix domain sockets 0.16 for Linux NET3.038.
Swansea University Computer Society TCP/IP for NET3.037
IP Protocols: ICMP, UDP, TCP
Starting kswapd v 1.5 
Console: switching to colour frame buffer device 80x25
fb0: Amiga AGA frame buffer device, using 1280K of video memory
pty: 256 Unix98 ptys configured
RAM disk driver initialized:  16 RAM disks of 4096K size
ide0: Gayle IDE interface (A1200 style)
hda: SAMSUNG PLS-31274A, ATA DISK drive
hdb: FX400E, ATAPI CDROM drive
ide0 at 80da0000 on irq 0x0000000c
hda: SAMSUNG PLS-31274A, 1213MB w/256kB Cache, CHS=2466/16/63
gfp called nonatomically from interrupt 0000645a

Out of memory for swapper.
gfp called nonatomically from interrupt 0000627c

Out of memory for swapper.
<<<<<<<<<<<<<<<<<<<<

Now, according to System.map 0000645a is in get_pointer_table() and
0000627c is in get_pte_slow(). I really don't get this. It happens as soon as
it tries to identify hdb, which is my Mitsumi CD-ROM drive.

By using the old code in include/asm-m68k/ide.h it just works. I think this
should be fixed before 2.2 comes out, but my knowledge of assembler is not
good enough to fix this.

Kars.

P.S.
Here is the diff I applied to get it to work again on my system. It just
reverses a patch Andreas sent a long time ago, I think.

--- linux/include/asm/ide.h.old	Tue Oct 13 12:48:03 1998
+++ linux/include/asm/ide.h	Tue Oct 13 12:48:16 1998
@@ -137,83 +137,81 @@
 #define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1)
 #define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1)
 
-#define insw(port, buf, nr) ({				\
-	unsigned char *_port = (unsigned char *)(port);	\
-	unsigned char *_buf = (buf);			\
-	int _nr = (nr);					\
-	unsigned long _tmp;				\
-							\
-	if (_nr & 15) {					\
-		_tmp = (_nr & 15) - 1;			\
-		asm volatile (				\
-			"1: movew %2@,%3@+; dbra %4,1b"	\
-			: "=a" (_buf), "=d" (_tmp)	\
-			: "a" (_port), "0" (_buf),	\
-			  "1" (_tmp));			\
-	}						\
-	_tmp = (_nr >> 4) - 1;				\
-	asm volatile (					\
-		"1: "					\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"movew %2@,%3@+; "			\
-		"dbra %4,1b"				\
-		: "=a" (_buf), "=d" (_tmp)		\
-		: "a" (_port), "0" (_buf),		\
-		  "1" (_tmp));				\
-})
+#define insw(port, buf, nr) \
+    if ((nr) % 16) \
+	__asm__ __volatile__ \
+	       ("movel %0,%/a0; \
+		 movel %1,%/a1; \
+		 movel %2,%/d6; \
+		 subql #1,%/d6; \
+	       1:movew %/a0@,%/a1@+; \
+		 dbra %/d6,1b" : \
+		: "g" (port), "g" (buf), "g" (nr) \
+		: "a0", "a1", "d6"); \
+    else \
+	__asm__ __volatile__ \
+	       ("movel %0,%/a0; \
+		 movel %1,%/a1; \
+		 movel %2,%/d6; \
+		 lsrl  #4,%/d6; \
+		 subql #1,%/d6; \
+	       1:movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 movew %/a0@,%/a1@+; \
+		 dbra %/d6,1b" : \
+		: "g" (port), "g" (buf), "g" (nr) \
+		: "a0", "a1", "d6")
 
-#define outsw(port, buf, nr) ({				\
-	unsigned char *_port = (unsigned char *)(port);	\
-	unsigned char *_buf = (buf);			\
-	int _nr = (nr);					\
-	unsigned long _tmp;				\
-							\
-	if (_nr & 15) {					\
-		_tmp = (_nr & 15) - 1;			\
-		asm volatile (				\
-			"1: movew %3@,%2@+; dbra %4,1b"	\
-			: "=a" (_buf), "=d" (_tmp)	\
-			: "a" (_port), "0" (_buf),	\
-			  "1" (_tmp));			\
-	}						\
-	_tmp = (_nr >> 4) - 1;				\
-	asm volatile (					\
-		"1: "					\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"movew %3@+,%2@; "			\
-		"dbra %4,1b"	   			\
-		: "=a" (_buf), "=d" (_tmp)		\
-		: "a" (_port), "0" (_buf),		\
-		  "1" (_tmp));				\
-})
+#define outsw(port, buf, nr) \
+    if ((nr) % 16) \
+	__asm__ __volatile__ \
+	       ("movel %0,%/a0; \
+		 movel %1,%/a1; \
+		 movel %2,%/d6; \
+		 subql #1,%/d6; \
+	       1:movew %/a1@+,%/a0@; \
+		 dbra %/d6,1b" : \
+		: "g" (port), "g" (buf), "g" (nr) \
+		: "a0", "a1", "d6"); \
+    else \
+	__asm__ __volatile__ \
+	       ("movel %0,%/a0; \
+		 movel %1,%/a1; \
+		 movel %2,%/d6; \
+		 lsrl  #4,%/d6; \
+		 subql #1,%/d6; \
+	       1:movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 movew %/a1@+,%/a0@; \
+		 dbra %/d6,1b" : \
+		: "g" (port), "g" (buf), "g" (nr) \
+		: "a0", "a1", "d6")
 
 #ifdef CONFIG_ATARI
 #define insl_swapw(data_reg, buffer, wcount) \

-- 
------------------------------------------------------------------------------
Kars de Jong             Signaalkamp rules the waves!       Turrican@Discworld
--------======]**-----|      jongk@cs.utwente.nl      |-----**[======---------

