Subject: port-vax/2377: NetBSD-current doesn't compile on VAX
To: None <gnats-bugs@NetBSD.ORG>
From: Arne H. Juul <arnej@pvv.unit.no>
List: netbsd-bugs
Date: 05/06/1996 19:23:07
>Number:         2377
>Category:       port-vax
>Synopsis:       NetBSD-current doesn't compile on VAX
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May  6 13:35:00 1996
>Last-Modified:
>Originator:     Arne H. J.
>Organization:
	Norwegian University of Technology and Science
>Release:        NetBSD-current as of Mon May  6 19:13:06 MET DST 1996
>Environment:
	
System: NetBSD dvask.pvv.unit.no 1.1B NetBSD 1.1B (DVSK) #1: Sun May 5 20:41:15 MET DST 1996 arnej@dvask.pvv.unit.no:/usr/src/sys/arch/vax/compile/DVSK vax


>Description:
	NetBSD-current doesn't compile on VAX.  Mostly it seems to
	be rather trivial prototyping fixups and so on that is now
	needed, and I've attempted to fix these myself.  Some has
	been fixed by #include'ing rather indiscriminately; this
	could probably be done a bit prettier. There still remains
	some warnings about volatile pointers in uda.c, so I did
	that one without -Werror for now - somebody who knows more
	about what actually *is* volatile needs to look at this.
	I'm pretty sure that the type and prototype changes I've
	done goes in the right direction, though.
>How-To-Repeat:
	Sup -current code to your NetBSD/vax machine, and try to compile
	the GENERIC kernel.
>Fix:
	Here's a patch to fix or workaround most of the current problems.
	I hope this is useful, with the speed of our uvaxII it's certainly
	a couple of days' work :-)

diff -ru vax/include/cpu.h vax.ok/include/cpu.h
--- vax/include/cpu.h	Wed Apr 10 13:36:05 1996
+++ vax.ok/include/cpu.h	Mon May  6 14:32:21 1996
@@ -30,9 +30,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _VAX_CPU_H_
+#define _VAX_CPU_H_
+
  /* All bugs are subject to removal without further notice */
 
 #include <sys/cdefs.h>
+#include <sys/device.h>
 #include <machine/mtpr.h>
 #include <machine/pcb.h>
 
@@ -49,7 +53,7 @@
 	int	(*cpu_clock) __P((void)); /* CPU dependent clock handling */
 	int	(*cpu_mchk) __P((caddr_t));   /* Machine check handling */
 	void	(*cpu_memerr) __P((void)); /* Memory subsystem errors */
-	void	(*cpu_conf) __P((void *, void *, void *)); /* Autoconfiguration */
+	void	(*cpu_conf) __P((struct device *, struct device *, void *)); /* Autoconfiguration */
 };
 
 struct clockframe {
@@ -100,3 +104,5 @@
 #ifdef DDB
 int	kdbrint __P((int));
 #endif
+
+#endif /* _VAX_CPU_H_ */
diff -ru vax/include/ka650.h vax.ok/include/ka650.h
--- vax/include/ka650.h	Wed Apr 10 13:36:07 1996
+++ vax.ok/include/ka650.h	Mon May  6 02:07:22 1996
@@ -237,7 +237,7 @@
 /* prototypes */
 struct sbi_attach_args;
 
-void	uvaxIII_conf __P((void *, void *, void *));
+void	uvaxIII_conf __P((struct device *, struct device *, void *));
 int	uvaxIII_clock __P((void));
 void	uvaxIII_memenable __P((struct sbi_attach_args *, struct device *));
 void	uvaxIII_memerr __P((void));
diff -ru vax/include/ka750.h vax.ok/include/ka750.h
--- vax/include/ka750.h	Wed Apr 10 13:36:07 1996
+++ vax.ok/include/ka750.h	Mon May  6 02:07:22 1996
@@ -43,7 +43,7 @@
 #define	V750PGS	4
 
 /* 11/750 specific prototypes */
-void	ka750_conf __P((void *, void *, void *));
+void	ka750_conf __P((struct device *, struct device *, void *));
 int	ka750_clock __P((void));
 void	ka750_memenable __P((struct sbi_attach_args *, struct device *));
 void	ka750_memerr __P((void));
diff -ru vax/include/uvaxII.h vax.ok/include/uvaxII.h
--- vax/include/uvaxII.h	Wed Apr 10 13:36:08 1996
+++ vax.ok/include/uvaxII.h	Mon May  6 17:44:53 1996
@@ -35,6 +35,9 @@
  */
 
 #if VAX630 || VAX410
+
+#include <sys/device.h>
+
 #define UVAXIISID	((u_long *)0x20040004)
 #define UVAXIICPU	((struct uvaxIIcpu *)0x20080000)
 
@@ -125,7 +128,7 @@
 struct	sbi_attach_args;
 
 /* Prototypes */
-void	uvaxII_conf __P((void *, void *, void *));
+void	uvaxII_conf __P((struct device *, struct device *, void *));
 int	uvaxII_clock __P((void));
 void	uvaxII_memenable __P((struct sbi_attach_args *, struct device *));
 void	uvaxII_memerr __P((void));
diff -ru vax/mba/hp.c vax.ok/mba/hp.c
--- vax/mba/hp.c	Wed Apr 10 13:36:08 1996
+++ vax.ok/mba/hp.c	Mon May  6 18:13:32 1996
@@ -51,7 +51,6 @@
 #include <sys/ioccom.h>
 #include <sys/fcntl.h>
 #include <sys/syslog.h>
-#include <sys/cpu.h>
 
 #include <machine/trap.h>
 #include <machine/pte.h>
diff -ru vax/uba/uda.c vax.ok/uba/uda.c
--- vax/uba/uda.c	Mon Mar 18 13:29:16 1996
+++ vax.ok/uba/uda.c	Mon May  6 02:07:28 1996
@@ -252,7 +252,13 @@
 /*
  * Definition of the driver for autoconf.
  */
-int	udaprobe(), udaslave(), udaattach(), udadgo(), udaintr();
+int	udaprobe(caddr_t, int, struct uba_ctlr *, struct uba_softc *);
+int	udaslave(struct uba_device *, caddr_t);
+void	udaattach(struct uba_device *);
+void	udadgo(struct uba_ctlr *);
+
+void	udaintr();
+
 struct	uba_ctlr *udaminfo[NUDA];
 struct	uba_device *udadinfo[NRA];
 struct	disklabel udalabel[NRA];
@@ -265,8 +271,15 @@
 /*
  * More driver definitions, for generic MSCP code.
  */
-int	udadgram(), udactlrdone(), udaunconf(), udaiodone();
-int	udaonline(), udagotstatus(), udaioerror(), udareplace(), udabb();
+void	udadgram(struct mscp_info *, struct mscp *);
+void	udactlrdone(struct mscp_info *, struct mscp *);
+int	udaunconf(struct mscp_info *, struct mscp *);
+void	udaiodone(struct mscp_info *, struct buf *, int);
+int	udaonline(struct uba_device *, struct mscp *);
+int	udagotstatus(struct uba_device *, struct mscp *);
+int	udaioerror(struct uba_device *, struct mscp *, struct buf *);
+void	udareplace(struct uba_device *, struct mscp *);
+void	udabb(struct uba_device *, struct mscp *, struct buf *);
 
 struct	buf udautab[NRA];	/* per drive transfer queue */
 
@@ -277,6 +290,15 @@
    "uda", "ra" };
 
 /*
+ * Miscalleneous prototypes
+ */
+void udastart(struct uba_ctlr *);
+void udastrat1(struct buf *);
+void uda_rasave(int, struct mscp *, int);
+
+ 
+
+/*
  * Miscellaneous private variables.
  */
 char	udasr_bits[] = UDASR_BITS;
@@ -324,6 +346,7 @@
 {
 }
 
+int
 udaprobe(reg, ctlr, um, uhp)
 	caddr_t reg;
 	int ctlr;
@@ -460,6 +483,7 @@
  * Note that by the time udaslave is called, the interrupt vector
  * for the UDA50 has been set up (so that udaunconf() will be called).
  */
+int
 udaslave(ui, reg)
 	register struct uba_device *ui;
 	caddr_t reg;
@@ -630,6 +654,7 @@
  * what?).  Set up the inverting pointer, and attempt to bring the
  * drive on line and read its label.
  */
+void
 udaattach(ui)
 	register struct uba_device *ui;
 {
@@ -671,6 +696,7 @@
 /*
  * Initialise a UDA50.  Return true iff something goes wrong.
  */
+int
 udainit(ctlr)
 	int ctlr;
 {
@@ -748,6 +774,7 @@
  * Open a drive.
  */
 /*ARGSUSED*/
+int
 udaopen(dev, flag, fmt)
 	dev_t dev;
 	int flag, fmt;
@@ -857,6 +884,7 @@
 }
 
 /* ARGSUSED */
+int
 udaclose(dev, flags, fmt)
 	dev_t dev;
 	int flags, fmt;
@@ -895,6 +923,7 @@
  * and set a timeout on it in case it fails to respond.
  * When on line, read in the pack label.
  */
+int
 uda_rainit(ui, flags)
 	volatile struct uba_device *ui;
 	int flags;
@@ -991,6 +1020,7 @@
  * Copy the geometry information for the given ra from a
  * GET UNIT STATUS response.  If check, see if it changed.
  */
+void
 uda_rasave(unit, mp, check)
 	int unit;
 	register struct mscp *mp;
@@ -1100,6 +1130,7 @@
 /*
  * Work routine for udastrategy.
  */
+void
 udastrat1(bp)
 	register struct buf *bp;
 {
@@ -1160,6 +1191,7 @@
  * Start up whatever transfers we can find.
  * Note that udastart() must be called at splbio().
  */
+void
 udastart(um)
 	register struct uba_ctlr *um;
 {
@@ -1307,6 +1339,7 @@
  * this calls us again immediately we will not recurse, because
  * that time we will be in udastart().  Clever....
  */
+void
 udadgo(um)
 	register struct uba_ctlr *um;
 {
@@ -1333,6 +1366,7 @@
 		udastart(um);
 }
 
+void
 udaiodone(mi, bp, info)
 	register struct mscp_info *mi;
 	struct buf *bp;
@@ -1425,6 +1459,7 @@
  * continue initialisation, or acknowledge command and response
  * interrupts, and process responses.
  */
+void
 udaintr(ctlr)
 {
 	struct uba_ctlr *um = udaminfo[ctlr];
@@ -1616,6 +1651,7 @@
 /*
  * Handle an error datagram.
  */
+void
 udadgram(mi, mp)
 	struct mscp_info *mi;
 	struct mscp *mp;
@@ -1637,6 +1673,7 @@
  * The Set Controller Characteristics command finished.
  * Record the new state of the controller.
  */
+void
 udactlrdone(mi, mp)
 	register struct mscp_info *mi;
 	struct mscp *mp;
@@ -1661,6 +1698,7 @@
  * Received a response from an as-yet unconfigured drive.  Configure it
  * in, if possible.
  */
+int
 udaunconf(mi, mp)
 	struct mscp_info *mi;
 	register struct mscp *mp;
@@ -1692,6 +1730,7 @@
  * we think the drive is truly on line.  In any case, awaken anyone
  * sleeping on the drive on-line-ness.
  */
+int
 udaonline(ui, mp)
 	register struct uba_device *ui;
 	struct mscp *mp;
@@ -1722,6 +1761,7 @@
 /*
  * We got some (configured) unit's status.  Return DONE if it succeeded.
  */
+int
 udagotstatus(ui, mp)
 	register struct uba_device *ui;
 	register struct mscp *mp;
@@ -1743,6 +1783,7 @@
  * Need to write the bad block forwaring code first....
  */
 /*ARGSUSED*/
+int
 udaioerror(ui, mp, bp)
 	register struct uba_device *ui;
 	register struct mscp *mp;
@@ -1775,6 +1816,7 @@
  * A replace operation finished.
  */
 /*ARGSUSED*/
+void
 udareplace(ui, mp)
 	struct uba_device *ui;
 	struct mscp *mp;
@@ -1787,6 +1829,7 @@
  * A bad block related operation finished.
  */
 /*ARGSUSED*/
+void
 udabb(ui, mp, bp)
 	struct uba_device *ui;
 	struct mscp *mp;
diff -ru vax/vax/autoconf.c vax.ok/vax/autoconf.c
--- vax/vax/autoconf.c	Wed Apr 10 13:36:15 1996
+++ vax.ok/vax/autoconf.c	Mon May  6 02:07:29 1996
@@ -66,7 +66,7 @@
 
 extern int cold;
 
-void    notsupp_conf __P((void *, void *, void *));
+void	notsupp_conf __P((struct device *, struct device *, void *));
 int     notsupp_clock __P((void));
 void    notsupp_memerr __P((void));
 int     notsupp_mchk __P((caddr_t));
@@ -74,7 +74,7 @@
 
 
 #ifdef VAX8600 /* XXX These are in ka860 also */
-void    ka86_conf __P((void *, void *, void *));
+void    ka86_conf __P((struct device *, struct device *, void *));
 int     ka86_clock __P((void));
 void    ka86_memenable __P((struct sbi_attach_args *, struct device *));
 void    ka86_memerr __P((void));
@@ -82,7 +82,7 @@
 void    ka86_steal_pages __P((void));
 #endif
 #ifdef VAX780 /* XXX These are in ka780 also */
-void    ka780_conf __P((void *, void *, void *));
+void    ka780_conf __P((struct device *, struct device *, void *));
 int     ka780_clock __P((void));
 void    ka780_memenable __P((struct sbi_attach_args *, void *));
 void    ka780_memerr __P((void));
@@ -180,7 +180,8 @@
 
 void
 notsupp_conf(dev, dev2, a)
-	void *dev, *dev2, *a;
+	struct device *dev, *dev2;
+	void *a;
 {
 }
 
diff -ru vax/vax/disksubr.c vax.ok/vax/disksubr.c
--- vax/vax/disksubr.c	Wed Apr 10 13:36:18 1996
+++ vax.ok/vax/disksubr.c	Mon May  6 18:13:06 1996
@@ -41,8 +41,8 @@
 #include <sys/dkbad.h>
 #include <sys/disklabel.h>
 #include <sys/syslog.h>
-#include <sys/cpu.h>
 
+#include <machine/cpu.h>
 #include <machine/macros.h>
 
 /* XXX encoding of disk minor numbers, should be elsewhere... */
diff -ru vax/vax/machdep.c vax.ok/vax/machdep.c
--- vax/vax/machdep.c	Wed Apr 10 13:36:25 1996
+++ vax.ok/vax/machdep.c	Mon May  6 18:12:46 1996
@@ -63,7 +63,6 @@
 #include <sys/device.h>
 #include <sys/exec.h>
 #include <sys/mount.h>
-#include <sys/cpu.h>
 #include <sys/syscallargs.h>
 #include <sys/ptrace.h>
 #ifdef SYSVMSG
@@ -112,7 +111,7 @@
 #endif
 
 void	netintr __P((void));
-void	machinecheck __P((u_int));
+void	machinecheck __P((caddr_t));
 void	cmrerr __P((void));
 
 extern int virtual_avail, virtual_end;
@@ -634,7 +633,7 @@
 
 void
 machinecheck(frame)
-	u_int           frame;
+	caddr_t		frame;
 {
 	if ((*cpu_calls[cpunumber].cpu_mchk) (frame) == 0)
 		return;
diff -ru vax/vax/trap.c vax.ok/vax/trap.c
--- vax/vax/trap.c	Wed Apr 10 13:36:31 1996
+++ vax.ok/vax/trap.c	Mon May  6 18:13:22 1996
@@ -42,12 +42,12 @@
 #include <sys/systm.h>
 #include <sys/signalvar.h>
 #include <sys/exec.h>
-#include <sys/cpu.h>
 
 #include <vm/vm.h>
 #include <vm/vm_kern.h>
 #include <vm/vm_page.h>
 
+#include <machine/cpu.h>
 #include <machine/mtpr.h>
 #include <machine/pte.h>
 #include <machine/pcb.h>
diff -ru vax/vax/vm_machdep.c vax.ok/vax/vm_machdep.c
--- vax/vax/vm_machdep.c	Wed Apr 10 13:36:32 1996
+++ vax.ok/vax/vm_machdep.c	Mon May  6 18:13:15 1996
@@ -41,7 +41,6 @@
 #include <sys/vnode.h>
 #include <sys/core.h>
 #include <sys/mount.h>
-#include <sys/cpu.h>
 
 #include <vm/vm.h>
 #include <vm/vm_kern.h>
>Audit-Trail:
>Unformatted: