From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: Re: L68K: 2.1.90
To: mduponch@cisco.com (Marc Duponcheel)
Date: Sat, 21 Mar 1998 21:15:00 +0100 (MET)
Cc: linux-m68k@lists.linux-m68k.org, Jes.Sorensen@cern.ch
In-Reply-To: <Pine.SV4.3.96.980321152006.3573A-100000@bru-cse-059.cisco.com> from "Marc Duponcheel" at Mar 21, 98 03:22:46 pm
Sender: owner-linux-m68k@phil.uni-sb.de

Hi,

> gcc -D__KERNEL__ -I/var/src/linux-2.1.90/include -Wall -Wstrict-prototypes -O2 -fomit-frame-po-a2   -c -o genhd.o genhd.c
> genhd.c:507: parse error before `EXPORT_SYMTAB_not_defined'
> genhd.c:507: warning: data definition has no type or storage class
> genhd.c:508: parse error before `EXPORT_SYMTAB_not_defined'
> genhd.c:508: warning: data definition has no type or storage class
> genhd.c:509: parse error before `EXPORT_SYMTAB_not_defined'
> genhd.c:509: warning: data definition has no type or storage class
> genhd.c:510: parse error before `EXPORT_SYMTAB_not_defined'
> genhd.c:510: warning: data definition has no type or storage class
> genhd.c:511: parse error before `EXPORT_SYMTAB_not_defined'
> genhd.c:511: warning: data definition has no type or storage class
> 
> I'll try without modules enabled now.

Here is the patch for this.
It also includes a small optimization for the ide driver (that also removes
the warning) and finally an 'u32' must not be visible in header file for the
outer world (otherwise lilo doesn't compile).

Roman

--- linux-2.1.90/drivers/block/Makefile.old	Sat Mar 21 18:52:37 1998
+++ linux-2.1.90/drivers/block/Makefile	Sat Mar 21 18:54:24 1998
@@ -20,10 +20,10 @@
 
 
 L_TARGET := block.a
-L_OBJS   := genhd.o
+L_OBJS   := 
 M_OBJS   :=
 MOD_LIST_NAME := BLOCK_MODULES
-LX_OBJS := ll_rw_blk.o
+LX_OBJS := ll_rw_blk.o genhd.o
 MX_OBJS :=
 
 ifeq ($(CONFIG_MSDOS_PARTITION),y)
--- linux-2.1.90/include/asm-m68k/ide.h.old	Sat Mar 21 18:56:38 1998
+++ linux-2.1.90/include/asm-m68k/ide.h	Sat Mar 21 20:13:21 1998
@@ -117,81 +117,75 @@
 #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) \
-    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 insw(port, buf, nr) ({				\
+	unsigned char *_port = (unsigned char *)(port);	\
+	unsigned char *_buf = (buf);			\
+	int _nr = (nr);					\
+							\
+	if (_nr & 15)					\
+		asm volatile (				\
+			"1: movew %1@,%2@+; dbra %3,1b"	\
+			: "=a" (_buf)			\
+			: "a" (_port), "0" (_buf),	\
+			  "d" ((_nr & 15) - 1));	\
+	asm volatile (					\
+		"1: "					\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"movew %1@,%2@+; "			\
+		"dbra %3,1b"				\
+		: "=a" (_buf)				\
+		: "a" (_port), "0" (_buf),		\
+		  "d" ((_nr >> 4) - 1));		\
+})
 
-#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")
+#define outsw(port, buf, nr) ({				\
+	unsigned char *_port = (unsigned char *)(port);	\
+	unsigned char *_buf = (buf);			\
+	int _nr = (nr);					\
+							\
+	if (_nr & 15)					\
+		asm volatile (				\
+			"1: movew %2@,%1@+; dbra %3,1b"	\
+			: "=a" (_buf)			\
+			: "a" (_port), "0" (_buf),	\
+			  "d" ((_nr & 15) - 1));	\
+	asm volatile (					\
+		"1: "					\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"movew %2@+,%1@; "			\
+		"dbra %3,1b"				\
+		: "=a" (_buf)				\
+		: "a" (_port), "0" (_buf),		\
+		  "d" ((_nr >> 4) - 1));		\
+})
 
 #ifdef CONFIG_ATARI
 #define insl_swapw(data_reg, buffer, wcount) \
--- linux-2.1.90/include/linux/zorro.h.old	Sat Mar 21 20:16:40 1998
+++ linux-2.1.90/include/linux/zorro.h	Sat Mar 21 20:16:53 1998
@@ -87,7 +87,7 @@
 #define ZORRO_ID(manuf, prod, epc) \
     ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
 
-typedef u32 zorro_id;
+typedef __u32 zorro_id;
 
 
 #define ZORRO_MANUF_PACIFIC_PERIPHERALS				0x00D3
