*BSD News Article 56008


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech2!news.jsums.edu!despina.neptune.com!usenet.eel.ufl.edu!brutus.bright.net!chi-news.cic.net!newsfeed.internetmci.com!in2.uu.net!spcuna!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: 18bit RX02 controllers don't work on Q22 systems (#280)
Sender: news@wlbr.iipo.gtegsc.com (Steven M. Schultz)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <DIqssq.K6D@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Tue, 28 Nov 1995 07:29:12 GMT
Lines: 1214

Subject: 18bit RX02 controllers don't work on Q22 systems (#280)
Index:	pdp,pdpuba/machdep.c,rx.c,rl.c 2.11BSD

Description:
	On 22 bit Qbus systems the DEC RX controller (as well as 3rd party
	subsystems such as the DSD-440) was not usable because it could
	only access the low 256kb (18 bit Qbus address range) of memory.

	The same problem existed with the RL controller portion of the
	DSD-880.

	Also the RX driver (pdpuba/rx.c) did not handle 22 bit controllers
	correctly.  Although DEC did not make 22 bit RX controllers the
	Sigma MXV22 had a 22 bit mode.

	The probe routine in /etc/autoconfig was wrong - it would not
	reliably detect an RX controller.

Repeat-By:
	Have an 18 bit RX02 controller present in a 22 bit Qbus system.  If the
	device configures at all then try to perform a read or write to
	the drive.  Note the immediate panic or hang as part of the kernel
	is overwritten.

Fix:
	The solution was to implement a "bounce buffer" - a region of
	memory allocated below 256kb into which the I/O takes place.  Data
	to be written to the 18 bit controller is first copied into the
	bounce buffer and the DMA is done out of the bounce buffer.  When
	a read opeation is to be done the data is DMA'd into the bounce
	buffer first and then copied to its final destination.
	
	The term 'software unibus/qbus map' was used a long time ago to
	describe this technique.  An actual software 'qbus map' would perhaps
	have been more elegant but would have been much more work (as well
	as requiring the flags word in the 'buf' structure to become a 'long')
	for relatively little benefit.

	The bounce buffer is 10kb in size.  Thus raw I/O to 18 bit devices
	is restricted to 10kb (20 sectors).  This is the size of I/O which
	'dump', 'restor' and 'tar' all use so 10kb is a realistic limit.  I/O
	to/from the filesystem is always done in 1kb (2 sector) units - so the
	10kb limitation does not enter into the picture.

	There is only 1 bounce buffer.  If more than one 18bit controller
	is present in the system then access to the bounce buffer will
	be serialized.

	Credit where credit is due - I rescued much of the code from the
	/sys/OTHERS directory.  The 'software map' (bounce buffer) came
	from /sys/OTHERS/18bit_22bit and the improved RX02 driver came out 
	of /sys/OTHERS/rx02/#2.  The changes to the RX02 and RL
	drivers to use the 'soft map' were my handywork.  Thanks go to
	Tim Shoppa for the use of his 11/73 and RX02 drives for the debug
	effort.

	The attached shar file contains two items:  a shell script (which
	you may either use directly or perform the steps manually) and a
	patch file.

	When the shar file is unpacked it will create two files in /tmp:
	script.280 and patch.280.

	/tmp/script.280 renames several files in /sys/pdpuba, moves several
	files from /sys/OTHERS into /sys/pdpuba and then deletes the 
	directories from /sys/OTHERS.  If you'd rather leave /sys/OTHERS
	intact then you'll want to substitute 'cp' commands for the 'mv'
	commands and not perform the 'rm -r' commands.

	NOTE:  The GENERIC kernel config file has changed and now includes
	       the option 'SOFUB_MAP'.  If you wish to incorporate 18bit
	       controller support into existing kernels you will need to
	       modify their config files in the same way that GENERIC's was.

	       The GENERIC kernel includes SOFUB_MAP as a standard option.

	NOTE:  The Makefile used to build GENERIC kernels (conf/Make.sunix)
	       was modified because the overlay structure required changes
	       (the bounce buffer logic caused several modules to grow).
	       IF you do include the option SOFUB_MAP in existing kernels
	       you will likely have to shuffle some overlays around.

	And now on to the installation of the update...

	Cut where indicated, saving the attached shar file to a temp file
	(/tmp/280).  Then:

		cd /tmp
		sh 280
		sh script.280
		patch -p0 < patch.280
		cd /sys/autoconfig
		make clean
		make
		make install
		make clean

	This is optional, but if the idea of keeping a current GENERIC
	kernel appeals to you then:

		cd /sys
		rm -r GENERIC
		cd conf
		./config GENERIC
		cd ../GENERIC
		make
		mv unix /genunix

	Unless you have RX02 devices present you do not need to recompile
	your existing kernel.  It is a good idea to go into /sys/conf
	and make sure that all kernel config files have included in them
	the new SOFUB_MAP option set to NO - simply replicate the paragraph
	from GENERIC's file.

============================cut here=========================
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	/tmp/script.280
#	/tmp/patch.280
# This archive created: Mon Nov 27 22:41:03 1995
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '/tmp/script.280'
then
	echo shar: "will not over-write existing file '/tmp/script.280'"
else
sed 's/^X//' << \SHAR_EOF > '/tmp/script.280'
X#!/bin/sh -v
X
Xmv /sys/pdpuba/rx.c /sys/pdpuba/rx.c.old
Xmv /sys/pdpuba/rxreg.h /sys/pdpuba/rxreg.h.old
Xmv /sys/autoconfig/rxauto.c /sys/autoconfig/rxauto.c.old
X
Xmv /sys/OTHERS/rx02/#2/rx.c /sys/pdpuba/rx.c
Xmv /sys/OTHERS/rx02/#2/rxreg.h /sys/pdpuba/rxreg.h
Xmv /sys/OTHERS/rx02/#2/rxauto.c /sys/autoconfig/rxauto.c
X
Xrm -r /sys/OTHERS/rx02/#2
Xrm -r /sys/OTHERS/18bit_22bit
SHAR_EOF
chmod 755 '/tmp/script.280'
fi
if test -f '/tmp/patch.280'
then
	echo shar: "will not over-write existing file '/tmp/patch.280'"
else
sed 's/^X//' << \SHAR_EOF > '/tmp/patch.280'
X*** /usr/src/sys/pdpuba/rx.c.old	Sat Jan  2 23:55:05 1993
X--- /usr/src/sys/pdpuba/rx.c	Mon Nov 27 21:08:48 1995
X***************
X*** 3,14 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rx.c	1.2 (2.11BSD GTE) 1/2/93
X   */
X  
X  /*
X   * RX02 floppy disk device driver
X   *
X   * This driver was written by Bill Shannon and distributed on the
X   * DEC v7m UNIX tape.  It has been modified for 2BSD and has been
X   * included with the permission of the DEC UNIX Engineering Group.
X--- 3,27 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rx.c	1.4 (2.11BSD GTE) 1995/11/27
X   */
X  
X  /*
X   * RX02 floppy disk device driver
X   *
X+  * sms - November 26, 1995.
X+  * Actually got it working with a 18 bit controller on a 22 bit Qbus.
X+  *
X+  * sms - November 21, 1995.  
X+  * Moved from OTHERS/rx02/#2 into the supported directory: sys/pdpuba.
X+  * Added conditionalized support for a "software unibus/qbus map" so that
X+  * 18 bit controllers could be supported in 22 bit Qbus systems.
X+  *
X+  * Date: Sun, 8 May 88 18:42:38 CDT
X+  * uunet!nuchat!steve@rutgers.edu (Steve Nuchia)
X+  * The rx02 driver as distributed didn't even come close to working
X+  * on a Q22 machine - probe was wrong and it got worse from there.
X+  *
X   * This driver was written by Bill Shannon and distributed on the
X   * DEC v7m UNIX tape.  It has been modified for 2BSD and has been
X   * included with the permission of the DEC UNIX Engineering Group.
X***************
X*** 36,41 ****
X--- 49,56 ----
X  #include "tty.h"
X  #include "rxreg.h"
X  #include "errno.h"
X+ #include "map.h"
X+ #include "uba.h"
X  
X  struct	rxdevice *RXADDR;
X  
X***************
X*** 48,53 ****
X--- 63,69 ----
X  #define	NBPS	((minor(bp->b_dev)&2) ? 256 : 128)	/* bytes per sector */
X  #define	DENSITY	(minor(bp->b_dev)&2)	/* Density: 0 = single, 2 = double */
X  #define	UNIT	(minor(bp->b_dev)&1)	/* Unit Number: 0 = left, 1 = right */
X+ #define	RXGID	(RX_GO | RX_IE | (DENSITY << 7))
X  
X  #define	rxwait()	while (((RXADDR->rxcs) & RX_XREQ) == 0)
X  #define	seccnt(bp)	((int)((bp)->b_seccnt))
X***************
X*** 56,61 ****
X--- 72,89 ----
X  struct	buf	crxbuf;		/* buffer header for control functions */
X  
X  /*
X+  * DEC controllers do not do 22 bit DMA but 3rd party (Sigma MXV-22) can.
X+  * 'rxsoftmap' can be patched (via 'adb') as indicated below to inhibit
X+  * the probing (checking bit 10 in the CSR) for 22 bit controllers.
X+ */
X+ 
X+ static	char	mxv22;		/* MXV22 can do native 22 bit DMA */
X+ static	char	rxsoftmap = -1;	/* -1 = OK to check for soft map
X+ 				 *  0 = Never use soft map
X+ 				 *  1 = Always use soft map
X+ 				*/
X+ 
X+ /*
X   *	states of driver, kept in b_state
X   */
X  #define	SREAD	1	/* read started */
X***************
X*** 68,80 ****
X  rxattach(addr, unit)
X  	struct rxdevice *addr;
X  	u_int unit;
X! {
X!     if (unit != 0)
X! 	return (0);
X!     RXADDR = addr;
X!     return (1);
X! }
X  
X  /*ARGSUSED*/
X  rxopen(dev, flag)
X  	dev_t dev;
X--- 96,117 ----
X  rxattach(addr, unit)
X  	struct rxdevice *addr;
X  	u_int unit;
X! 	{
X  
X+ 	if	(unit != 0)
X+ 		return(0);
X+ 	RXADDR = addr;
X+ 	if	(addr->rxcs & RX_Q22)	/* 22 bit capable? */
X+ 		mxv22 = 1;
X+ /*
X+  * If it is not a 22 bit controller and there is no Unibus map and
X+  * it is permitted to switch to a soft map then set the "use soft map" flag.
X+ */
X+ 	if	(!mxv22 && !ubmap && rxsoftmap == -1)
X+ 		rxsoftmap = 1;
X+ 	return(1);
X+ 	}
X+ 
X  /*ARGSUSED*/
X  rxopen(dev, flag)
X  	dev_t dev;
X***************
X*** 91,97 ****
X  
X  	if (minor(bp->b_dev) >= 4 || !RXADDR)
X  		goto bad;
X- 	mapalloc(bp);
X  	if (bp->b_blkno >= NRXBLKS) {
X  		if (bp->b_flags&B_READ)
X  			bp->b_resid = bp->b_bcount;
X--- 128,133 ----
X***************
X*** 102,107 ****
X--- 138,154 ----
X  		iodone(bp);
X  		return;
X  	}
X+ 
X+ #ifdef	SOFUB_MAP
X+ 	if	(rxsoftmap == 1)
X+ 		{
X+ 		if	(sofub_alloc(bp) == 0)
X+ 			return;
X+ 		}
X+ 	else
X+ #endif
X+ 		mapalloc(bp);
X+ 
X  	bp->av_forw = (struct buf *) NULL;
X  
X  	/*
X***************
X*** 130,136 ****
X  rxstart()
X  {
X  	register struct buf *bp;
X! 	int addr, xmem;
X  	int n, sector, track;
X  
X  	if ((bp = rxtab.b_actf) == NULL) {
X--- 177,183 ----
X  rxstart()
X  {
X  	register struct buf *bp;
X! 	int addr, xmem, cmd;
X  	int n, sector, track;
X  
X  	if ((bp = rxtab.b_actf) == NULL) {
X***************
X*** 140,155 ****
X  
X  	if (bp == &crxbuf) {		/* is it a control request ? */
X  		rxtab.b_state = SFORMAT;
X! 		RXADDR->rxcs = RX_SMD | RX_GO | RX_IE
X! 					| (UNIT << 4) | (DENSITY << 7);
X  		rxwait();
X! 		RXADDR->rxdb = 0222;
X  	} else
X  	if (bp->b_flags & B_READ) {
X  		rxtab.b_state = SREAD;
X  		rxfactr((int)bp->b_blkno * NSPB + seccnt(bp), &sector, &track);
X! 		RXADDR->rxcs = RX_RSECT | RX_GO | RX_IE
X! 					| (UNIT << 4) | (DENSITY << 7);
X  		rxwait();
X  		RXADDR->rxsa = sector;
X  		rxwait();
X--- 187,200 ----
X  
X  	if (bp == &crxbuf) {		/* is it a control request ? */
X  		rxtab.b_state = SFORMAT;
X! 		RXADDR->rxcs = RX_SMD | RXGID | (UNIT << 4);
X  		rxwait();
X! 		RXADDR->rxdb = 0111;
X  	} else
X  	if (bp->b_flags & B_READ) {
X  		rxtab.b_state = SREAD;
X  		rxfactr((int)bp->b_blkno * NSPB + seccnt(bp), &sector, &track);
X! 		RXADDR->rxcs = RX_RSECT | RXGID | (UNIT << 4);
X  		rxwait();
X  		RXADDR->rxsa = sector;
X  		rxwait();
X***************
X*** 158,171 ****
X  		rxtab.b_state = SFILL;
X  		n = bp->b_resid >= NBPS ? NBPS : bp->b_resid;
X  		rxaddr ( bp, &addr, &xmem );
X! 		RXADDR->rxcs = RX_FILL | RX_Q22 | RX_GO
X! 					| RX_IE | (DENSITY << 7);
X  		rxwait();
X  		RXADDR->rxwc = n >> 1;
X  		rxwait();
X  		RXADDR->rxba = addr;
X! 		rxwait();
X! 		RXADDR->rxba = xmem;
X  	}
X  }
X  
X--- 203,222 ----
X  		rxtab.b_state = SFILL;
X  		n = bp->b_resid >= NBPS ? NBPS : bp->b_resid;
X  		rxaddr ( bp, &addr, &xmem );
X! 		if	(rxsoftmap <= 0)
X! 			cmd = RX_Q22;
X! 		else
X! 			cmd = 0;
X! 		RXADDR->rxcs = RX_FILL | RXGID | ((xmem & 3) << 12) | cmd;
X  		rxwait();
X  		RXADDR->rxwc = n >> 1;
X  		rxwait();
X  		RXADDR->rxba = addr;
X! 		if	(rxsoftmap <= 0)
X! 			{
X! 			rxwait();
X! 			RXADDR->rxba = xmem;
X! 			}
X  	}
X  }
X  
X***************
X*** 172,178 ****
X  rxintr()
X  {
X  	register struct buf *bp;
X! 	int n, sector, track;
X  static	rxerr[4];
X  	char	*decode;
X  	int addr, xmem;
X--- 223,229 ----
X  rxintr()
X  {
X  	register struct buf *bp;
X! 	int n, sector, track, cmd;
X  static	rxerr[4];
X  	char	*decode;
X  	int addr, xmem;
X***************
X*** 213,221 ****
X  			case 0310: decode = "write protected"; break;
X  			default: decode = "unknown error"; break;
X  			}
X! 			printf ( "rx: errcode %o = %s\n", rxerr[0], decode );
X  			rxtab.b_errcnt = 0;
X  			rxtab.b_actf = bp->av_forw;
X  			iodone(bp);
X  		}
X  		RXADDR->rxcs = RX_INIT;
X--- 264,276 ----
X  			case 0310: decode = "write protected"; break;
X  			default: decode = "unknown error"; break;
X  			}
X! 			printf("rx: err %o=%s\n", rxerr[0], decode );
X  			rxtab.b_errcnt = 0;
X  			rxtab.b_actf = bp->av_forw;
X+ #ifdef	SOFUB_MAP
X+ 			if	(rxsoftmap == 1)
X+ 				sofub_relse(bp, bp->b_bcount);
X+ #endif
X  			iodone(bp);
X  		}
X  		RXADDR->rxcs = RX_INIT;
X***************
X*** 229,249 ****
X  		rxtab.b_state = SEMPTY;
X  		n = bp->b_resid >= NBPS? NBPS : bp->b_resid;
X  		rxaddr ( bp, &addr, &xmem );
X! 		RXADDR->rxcs = RX_EMPTY | RX_Q22 | RX_GO
X! 					| RX_IE | (DENSITY << 7);
X  		rxwait();
X  		RXADDR->rxwc = n >> 1;
X  		rxwait();
X  		RXADDR->rxba = addr;
X! 		rxwait();
X! 		RXADDR->rxba = xmem;
X  		return;
X  
X  	case SFILL:			/* fill done, start write */
X  		rxtab.b_state = SWRITE;
X  		rxfactr((int)bp->b_blkno * NSPB + seccnt(bp), &sector, &track);
X! 		RXADDR->rxcs = RX_WSECT | RX_GO | RX_IE
X! 					| (UNIT << 4) | (DENSITY << 7);
X  		rxwait();
X  		RXADDR->rxsa = sector;
X  		rxwait();
X--- 284,309 ----
X  		rxtab.b_state = SEMPTY;
X  		n = bp->b_resid >= NBPS? NBPS : bp->b_resid;
X  		rxaddr ( bp, &addr, &xmem );
X! 		if	(rxsoftmap <= 0)
X! 			cmd = RX_Q22;
X! 		else
X! 			cmd = 0;
X! 		RXADDR->rxcs = RX_EMPTY | RXGID | ((xmem & 3) << 12) | cmd;
X  		rxwait();
X  		RXADDR->rxwc = n >> 1;
X  		rxwait();
X  		RXADDR->rxba = addr;
X! 		if	(rxsoftmap <= 0)
X! 			{
X! 			rxwait();
X! 			RXADDR->rxba = xmem;
X! 			}
X  		return;
X  
X  	case SFILL:			/* fill done, start write */
X  		rxtab.b_state = SWRITE;
X  		rxfactr((int)bp->b_blkno * NSPB + seccnt(bp), &sector, &track);
X! 		RXADDR->rxcs = RX_WSECT | RXGID | (UNIT << 4);
X  		rxwait();
X  		RXADDR->rxsa = sector;
X  		rxwait();
X***************
X*** 263,268 ****
X--- 323,332 ----
X  			bp->b_resid = 0;
X  			rxtab.b_errcnt = 0;
X  			rxtab.b_actf = bp->av_forw;
X+ #ifdef	SOFUB_MAP
X+ 			if	(rxsoftmap == 1)
X+ 				sofub_relse(bp, bp->b_bcount);
X+ #endif
X  			iodone(bp);
X  			break;
X  		}
X***************
X*** 324,334 ****
X  static
X  rxaddr(bp, addr, xmem)
X  	register struct buf *bp;
X! 	register char **addr, *xmem;
X  {
X! 	*addr = bp->b_un.b_addr + seccnt(bp) * NBPS;
X  	*xmem = bp->b_xmem;
X! 	if (*addr < bp->b_un.b_addr)		/* overflow, bump xmem */
X  		(*xmem)++;
X  }
X  
X--- 388,398 ----
X  static
X  rxaddr(bp, addr, xmem)
X  	register struct buf *bp;
X! 	register u_int *addr, *xmem;
X  {
X! 	*addr = (u_int)bp->b_un.b_addr + (seccnt(bp) * NBPS);
X  	*xmem = bp->b_xmem;
X! 	if (*addr < (u_int)bp->b_un.b_addr)	/* overflow, bump xmem */
X  		(*xmem)++;
X  }
X  
X*** /usr/src/sys/pdpuba/rl.c.old	Tue Aug  1 20:43:32 1995
X--- /usr/src/sys/pdpuba/rl.c	Mon Nov 27 20:40:01 1995
X***************
X*** 3,13 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rl.c	1.6 (2.11BSD GTE) 1995/08/01
X   */
X  
X  /*
X   *  RL01/RL02 disk driver
X   * Date: August 1, 1995
X   * Fix bug which prevented labeling disks with no label or a corrupted label.
X   * Correct typographical error, the raclose() routine was being called by
X--- 3,20 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rl.c	1.7 (2.11BSD GTE) 1995/11/27
X   */
X  
X  /*
X   *  RL01/RL02 disk driver
X+  *
X+  * Date: November 27, 1995
X+  * Add support for using the software unibus/qbus map.  This allows 3rd
X+  * party 18bit RL controllers (DSD-880) to be used in a 22bit Qbus system.
X+  * NOTE:  I have been told that the DEC RLV11 does not properly monitor
X+  * the I/O Page signal which means the RLV11 still can not be used.
X+  *
X   * Date: August 1, 1995
X   * Fix bug which prevented labeling disks with no label or a corrupted label.
X   * Correct typographical error, the raclose() routine was being called by
X***************
X*** 52,59 ****
X  
X  struct	rldevice *RLADDR;
X  
X! static	int	q22bae = 1;
X! 
X  	daddr_t	rlsize();
X  	int	rlstrategy();
X  	void	rldfltlbl();
X--- 59,69 ----
X  
X  struct	rldevice *RLADDR;
X  
X! static	char	q22bae;
X! static	char	rlsoftmap = -1;	/* -1 = OK to change during attach
X! 				 *  0 = Never use soft map
X! 				 *  1 = Always use soft map
X! 				 */
X  	daddr_t	rlsize();
X  	int	rlstrategy();
X  	void	rldfltlbl();
X***************
X*** 103,108 ****
X--- 113,124 ----
X  		return (0);
X  	if ((addr != (struct rldevice *)NULL) && (fioword(addr) != -1)) {
X  		RLADDR = addr;
X+ 		if (fioword(&addr->rlbae) == -1)
X+ 			q22bae = -1;
X+ #ifdef	SOFUB_MAP
X+ 		if (q22bae != 0 && !ubmap && rlsoftmap == -1)
X+ 			rlsoftmap = 1;
X+ #endif
X  		return (1);
X  	}
X  	RLADDR = (struct rldevice *)NULL;
X***************
X*** 343,349 ****
X  		bp->b_error = EROFS;
X  		goto bad;
X  		}
X! 	mapalloc(bp);
X  
X  	bp->av_forw = NULL;
X  	bp->b_cylin = (int)(bp->b_blkno/20L);
X--- 359,373 ----
X  		bp->b_error = EROFS;
X  		goto bad;
X  		}
X! #ifdef	SOFUB_MAP
X! 	if	(rlsoftmap == 1)
X! 		{
X! 		if	(sofub_alloc(bp) == 0)
X! 			return;
X! 		}
X! 	else
X! #endif
X! 		mapalloc(bp);
X  
X  	bp->av_forw = NULL;
X  	bp->b_cylin = (int)(bp->b_blkno/20L);
X***************
X*** 471,476 ****
X--- 495,504 ----
X  	if((bp != NULL)&&(rlutab[rl.dn].b_actf != NULL))
X  		rlseek((int)(rlutab[rl.dn].b_actf->b_blkno/20l),rl.dn);
X  #endif
X+ #ifdef	SOFUB_MAP
X+ 	if	(rlsoftmap == 1)
X+ 		sofub_relse(bp, bp->b_bcount);
X+ #endif
X  	iodone(bp);
X  	rlstart();
X  }
X***************
X*** 485,492 ****
X  	rladdr->rlda = (rl.chn << 6) | rl.sn;
X  	rladdr->rlba = (caddr_t)rl.rl_un.w[1];
X  	rladdr->rlmp = -(rl.bpart >> 1);
X- 	if	(q22bae == 1)
X- 		q22bae = (fioword(&rladdr->rlbae) == -1 ? -1 : 0);
X  	if	(q22bae == 0)
X  		rladdr->rlbae = rl.rl_un.w[0];
X  	rladdr->rlcs = rl.com | (rl.rl_un.w[0] & 03) << 4;
X--- 513,518 ----
X***************
X*** 625,630 ****
X--- 651,658 ----
X  		return(ENXIO);
X  	if	(pi->p_fstype != FS_SWAP)
X  		return(EFTYPE);
X+ 	if	(rlsoftmap == 1)	/* No crash dumps via soft map */
X+ 		return(EFAULT);
X  
X  	dumpsize = rlsize(dev) - dumplo;
X  	memblks = ctod(physmem);
X***************
X*** 666,673 ****
X  			rladdr->rlba = 0;
X  		} else {
X  			rladdr->rlba = loint(paddr);
X- 			if	(q22bae == 1)
X- 				q22bae = (fioword(&rladdr->rlbae) == -1 ? -1:0);
X  			if	(q22bae == 0)
X  				rladdr->rlbae = hiint(paddr);
X  			com |= (hiint(paddr) & 03) << 4;
X--- 694,699 ----
X*** /usr/src/sys/pdpuba/rxreg.h.old	Thu Sep  1 14:14:08 1988
X--- /usr/src/sys/pdpuba/rxreg.h	Tue Nov 21 21:56:29 1995
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rxreg.h	1.1 (2.10BSD Berkeley) 12/1/86
X   */
X  
X  struct	rxdevice	{
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rxreg.h	1.2 (2.11BSD GTE) 1995/11/21
X   */
X  
X  struct	rxdevice	{
X***************
X*** 24,30 ****
X  /* bits 13-12 are the extension bits */
X  #define	RX_RX02		0004000		/* rx02 (read only) */
X  
X! #define RX_Q22		0002000		/* enable 22-bit mode */
X  #define	RX_HD		0001000		/* DSD 480 head select */
X  #define	RX_DD		0000400		/* double density */
X  #define	RX_XREQ		0000200		/* transfer request */
X--- 24,30 ----
X  /* bits 13-12 are the extension bits */
X  #define	RX_RX02		0004000		/* rx02 (read only) */
X  
X! #define RX_Q22		0002000		/* enable 22-bit mode (DSD MXV-22) */
X  #define	RX_HD		0001000		/* DSD 480 head select */
X  #define	RX_DD		0000400		/* double density */
X  #define	RX_XREQ		0000200		/* transfer request */
X*** /usr/src/sys/conf/config.old	Fri Jul 21 20:55:37 1995
X--- /usr/src/sys/conf/config	Wed Nov 22 21:29:53 1995
X***************
X*** 8,13 ****
X--- 8,15 ----
X  #		  end, rely instead on the system administrator's choice of
X  #		  umask.
X  #	2/14/95 - added ingres lock driver.  removed vax cruft.
X+ #
X+ #	1995/11/22 - added software map (SOFUB_MAP) option.
X  
X  LO=../h/localopts.h
X  
X***************
X*** 147,152 ****
X--- 149,157 ----
X  fi
X  if [ $PROFILE = YES ]; then
X  	OPTS="$OPTS -DPROFILE"
X+ fi
X+ if [ $SOFUB_MAP = YES ]; then
X+ 	OPTS="$OPTS -DSOFUB_MAP"
X  fi
X  
X  echo "Creating device header files."
X*** /usr/src/sys/conf/GENERIC.old	Fri Jul 21 20:52:39 1995
X--- /usr/src/sys/conf/GENERIC	Wed Nov 22 21:23:34 1995
X***************
X*** 105,110 ****
X--- 105,115 ----
X  UCB_CLIST	NO			# clists moved from kernel data space
X  QUOTA		NO			# dynamic file system quotas
X  					# NOTE -- *very* expensive
X+ SOFUB_MAP	YES			# Software UNIBUS/QBUS map.  Permits
X+ 					# use of 18 bit controllers in a 22 bit
X+ 					# Qbus system.  Normally NO except for
X+ 					# the GENERIC kernel or if you actually
X+ 					# have an 18 bit RX02 on a Qbus system.
X  
X  # UCB_METER is fairly expensive, but various programs (iostat, vmstat, etc)
X  # use it.
X*** /usr/src/sys/conf/Make.sunix.old	Thu May 11 21:42:31 1995
X--- /usr/src/sys/conf/Make.sunix	Thu Nov 23 09:32:26 1995
X***************
X*** 9,15 ****
X  # software without specific prior written permission. This software
X  # is provided ``as is'' without express or implied warranty.
X  #
X! #	2.2 (2.11BSD GTE) 1995/05/11
X  #
X  #########################################################
X  # Non-network, but separate I/D kernel			#
X--- 9,15 ----
X  # software without specific prior written permission. This software
X  # is provided ``as is'' without express or implied warranty.
X  #
X! #	2.3 (2.11BSD GTE) 1995/11/22
X  #
X  #########################################################
X  # Non-network, but separate I/D kernel			#
X***************
X*** 48,58 ****
X  
X  BASE=	br.o dh.o dhu.o dhv.o dkbad.o dr.o dz.o init_sysent.o kern_clock.o \
X  	kern_descrip.o kern_mman.o kern_proc.o kern_sig.o kern_subr.o \
X! 	kern_synch.o lp.o machdep.o ra.o ram.o rk.o rl.o rx.o si.o \
X  	subr_rmap.o subr_xxx.o sys_inode.o sys_pipe.o trap.o tty.o \
X  	tty_conf.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o \
X  	ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_namei.o \
X! 	ufs_subr.o vm_sched.o xp.o
X  OV1=	sys_generic.o ufs_syscalls.o mem.o
X  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
X  OV3=	clock.o cons.o kern_pdp.o kern_time.o \
X--- 48,58 ----
X  
X  BASE=	br.o dh.o dhu.o dhv.o dkbad.o dr.o dz.o init_sysent.o kern_clock.o \
X  	kern_descrip.o kern_mman.o kern_proc.o kern_sig.o kern_subr.o \
X! 	kern_synch.o lp.o machdep.o ra.o ram.o rk.o si.o \
X  	subr_rmap.o subr_xxx.o sys_inode.o sys_pipe.o trap.o tty.o \
X  	tty_conf.o tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o \
X  	ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_namei.o \
X! 	ufs_subr.o xp.o
X  OV1=	sys_generic.o ufs_syscalls.o mem.o
X  OV2=	kern_acct.o kern_exec.o kern_exit.o kern_fork.o kern_resource.o
X  OV3=	clock.o cons.o kern_pdp.o kern_time.o \
X***************
X*** 61,69 ****
X  OV4=	hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
X  	quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o
X  OV5=	ht.o tm.o ts.o
X! OV6=	tmscp.o kern_sysctl.o
X! OV7=	mch_fpsim.o ingreslock.o ufs_disksubr.o
X! OV8=	vm_text.o
X  
X  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
X  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
X--- 61,69 ----
X  OV4=	hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
X  	quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o
X  OV5=	ht.o tm.o ts.o
X! OV6=	tmscp.o vm_text.o
X! OV7=	rl.o mch_fpsim.o ingreslock.o ufs_disksubr.o
X! OV8=	rx.o kern_sysctl.o vm_sched.o
X  
X  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
X  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
X*** /usr/src/sys/autoconfig/rxauto.c.old	Thu Sep  1 14:14:07 1988
X--- /usr/src/sys/autoconfig/rxauto.c	Tue Nov 21 21:45:42 1995
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rxauto.c	1.1 (2.10BSD Berkeley) 12/1/86
X   */
X  
X  #include "param.h"
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)rxauto.c	1.2 (2.11BSD GTE) 1995/11/21
X   */
X  
X  #include "param.h"
X*** /usr/src/sys/pdp/machdep2.c.old	Wed May  3 20:33:09 1995
X--- /usr/src/sys/pdp/machdep2.c	Wed Nov 22 20:42:50 1995
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)machdep2.c	2.4 (2.11BSD GTE) 1995/05/01
X   */
X  
X  #include "param.h"
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)machdep2.c	2.5 (2.11BSD GTE) 1995/11/22
X   */
X  
X  #include "param.h"
X***************
X*** 47,52 ****
X--- 47,58 ----
X  u_short	_iosize = 2 * (1928 + 1096 + 128);  /* enough for 2 TMSCP and 2 MSCP */
X  #endif
X  
X+ #ifdef	SOFUB_MAP
X+ extern	size_t	sofub_addr, sofub_off;
X+ extern	memaddr	sofub_base;
X+ extern	u_int	sofub_size;
X+ #endif
X+ 
X  segm	seg5;		/* filled in by initialization */
X  
X  /*
X***************
X*** 138,143 ****
X--- 144,184 ----
X  #else
X  	clstaddr = (ubadr_t)cfree;
X  #endif
X+ 
X+ /*
X+  * IMPORTANT.  The software Unibus/Qbus map is allocated now if support for
X+  * 18 bit controllers in a 22 bit system has been selected.  This buffer must
X+  * reside _entirely_ within the low 256kb of memory.  A 10kb buffer is 
X+  * allocated, this is sufficient to handle 'dump', 'restor' and the default
X+  * blocking factor of 'tar' (20 sectors).
X+  *
X+  * NOTE:  There is only 1 software map.  Multiple 18 bit controllers will
X+  * have their access to the 'bounce buffer' single threaded by the soft
X+  * map allocation routine sofub_alloc() in machdep.c.
X+  *
X+  * For more details see machdep.c.
X+ */
X+ 
X+ #ifdef	SOFUB_MAP
X+ #define	B	(10240+64)
X+ 
X+ 	sofub_size = (unsigned) B;
X+ 
X+ 	if	((sofub_base = malloc(coremap, btoc(B))) == 0)
X+ 		panic("sofmap");			/* Paranoia */
X+ 	else if	(((sofub_base + btoc(B)) >> 10) > 3)	/* > 256kb! */
X+ 		{
X+ 		printf("sofmap > 256kb\n");
X+ 		mfree(coremap, btoc(B), sofub_base);	/* give it back */
X+ 		sofub_base = 0;
X+ 		}
X+ 	else
X+ 		{
X+ 		sofub_addr = sofub_base;
X+ 		sofub_off = (sofub_base>>10)&3;
X+ 		}
X+ #undef	B
X+ #endif /* SOFUB_MAP */
X  
X  #ifdef EXTERNALITIMES
X  #define C (btoc(ninode * sizeof (struct icommon2)))
X*** /usr/src/sys/pdp/mch_click.s.old	Tue Mar 16 18:42:53 1993
X--- /usr/src/sys/pdp/mch_click.s	Wed Nov 22 20:44:50 1995
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)mch_click.s	1.3 (2.11BSD GTE) 3/16/93
X   */
X  
X  #include "DEFS.h"
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)mch_click.s	1.4 (2.11BSD GTE) 1995/11/22
X   */
X  
X  #include "DEFS.h"
X***************
X*** 99,105 ****
X  	mov	(sp)+,KDSA5		/ restore seg5
X  	jmp	cret
X  
X- #ifdef INET
X  /*
X   * copyv(fromaddr, toaddr, count)
X   *	virtual_addr	fromaddr,
X--- 99,104 ----
X***************
X*** 172,179 ****
X  4:
X  	clr	r0			/ clear r0 and r1 (why?)
X  	rts	pc			/   and return
X- #endif
X- 
X  
X  /*
X   * fmove(par, pdr, from, to, length)
X--- 171,176 ----
X*** /usr/src/sys/pdp/machdep.c.old	Sun Jan  3 00:42:07 1993
X--- /usr/src/sys/pdp/machdep.c	Mon Nov 27 20:01:26 1995
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)machdep.c	2.1 (2.11BSD) 1/3/93
X   */
X  
X  #include "param.h"
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)machdep.c	2.2 (2.11BSD) 1995/11/22
X   */
X  
X  #include "param.h"
X***************
X*** 15,20 ****
X--- 15,21 ----
X  #include "buf.h"
X  #include "map.h"
X  #include "uba.h"
X+ #include "syslog.h"
X  
X  #ifdef CURRENTLY_EXPANDED_INLINE
X  /*
X***************
X*** 260,262 ****
X--- 261,485 ----
X  		bp->b_flags &= ~B_UBAREMAP;
X  	}
X  }
X+ 
X+ #define	SOFUB_DEBUG
X+ 
X+ #ifdef	SOFUB_MAP
X+ /*
X+  * Implement soft unibus map for 18 bit controllers present in a
X+  * 22-bit q-bus systems.  Initially only used by the tape driver 
X+  * (for tar and dump) but when this was integrated into 2.11BSD changes
X+  * were made to support the RX02 driver as well.
X+  *
X+  * Adapted to 2.11BSD and rather heavily revised by:
X+  *
X+  *		steven schultz (sms)
X+  *		GTE Government Systems
X+  *
X+  *	from the original by:
X+  *
X+  *		matt jacob
X+  *		University of California at Davis
X+  *		22-Nov-84
X+ */
X+ 
X+ #define	QMEG	((long)(256L*1024L))
X+ #define	exad(x,y)	((long)((long)x<<16|(unsigned)y))
X+ #define	B_UBUF		exad(bp->b_xmem,(u_int)bp->b_un.b_addr)
X+ #define	E_UBUF		(B_UBUF + (long) bp->b_bcount)
X+ 
X+ 	size_t	sofub_addr, sofub_off;
X+ 	memaddr	sofub_base;
X+ 	unsigned sofub_size;
X+ 
X+ static	int	bpxm, bpadd;
X+ static	int	sofub_flags;
X+ #define	BUSY	1
X+ #define	WANTED	2
X+ 
X+ /*
X+  * sofub_alloc - allocate usage of soft unibus map
X+  *
X+  *	called from strategy routine of device drivers.
X+  *
X+  *	returns 0 if not okay, else returns 1.
X+  *	expects a buffer pointer as an argument
X+  *	expects all addresses in bp already validated (by physio)
X+  *	sets appropriate bits and calls iodone if error
X+ */
X+ 
X+ int
X+ sofub_alloc(bp)
X+ register struct buf *bp;
X+ 	{
X+ 	register int s;
X+ 	register int count;
X+ 	size_t uaddr;
X+ 	memaddr sbase;
X+ 
X+ 	if	(E_UBUF < QMEG)
X+ 		return(1);	/* okay, < 256kb	*/
X+ 	else if	(bp->b_bcount > sofub_size)
X+ 		{
X+ 		log(LOG_ERR, "I/O >10kb on %d,%d\n",
X+ 			major(bp->b_dev),minor(bp->b_dev));
X+ 		bp->b_flags |= B_ERROR;
X+ 		bp->b_error = EFAULT;
X+ 		iodone(bp);
X+ 		return(0);
X+ 		}
X+ 
X+ 	s = splbio();
X+ 
X+ 	while	(sofub_flags & BUSY)
X+ 		{
X+ #ifdef SOFUB_DEBUG
X+ 		printf("sofub_alloc sleep\n");
X+ #endif
X+ 		sofub_flags |= WANTED;
X+ 		sleep((caddr_t) &sofub_flags,PSWP+2);
X+ 		}
X+ 
X+ 	sofub_flags |= BUSY;
X+ 	splx(s);
X+ 
X+ 	/*
X+ 	 * now calculate virtual address of user buffer...
X+ 	 */
X+ 
X+ 	sofub_off = (size_t)((u_int)bp->b_un.b_addr & 077);
X+ 	sofub_addr = (size_t)(((u_int)bp->b_un.b_addr>>6)&01777) | (((int) bp->b_xmem) << 10);
X+ 
X+ 	bpadd = (u_int)bp->b_un.b_addr;
X+ 	bpxm = bp->b_xmem;
X+ 
X+ 	/*
X+ 	 * if this is a write, we have to fetch data from user buffer first
X+ 	 */
X+ 
X+ 	if	((bp->b_flags & B_READ) == 0)
X+ 		{
X+ 		count = bp->b_bcount;
X+ 		uaddr = sofub_addr;
X+ 		sbase = sofub_base;
X+ 
X+ 		/* first, copy all 8kb-1click segments.. */
X+ 
X+ 		s = spl5();
X+ 
X+ 		while	(count > (8192-64))
X+ 			{
X+ 			copyv(uaddr,sofub_off,sbase,0,(8192-64));
X+ 			count -= (8192-64);
X+ 			uaddr += 0177;	/* add 8192-64 bytes */
X+ 			sbase += 0177;
X+ 			}
X+ 		/* copy last residual segment */
X+ 
X+ 		copyv(uaddr,sofub_off,sbase,0,count);
X+ 		splx(s);
X+ 		}
X+ 	/* put in new 18 bit address */
X+ 
X+ 	bp->b_un.b_addr = (caddr_t)ctob((long)sofub_base);
X+ 
X+ 	/*
X+ 	 * don't turn sofub_base to clicks here
X+ 	 * because half the work is done by
X+ 	 * having it in click form here, i.e.,
X+ 	 * bp->b_xmem would equal
X+ 	 * ctob(x)>>16 (hi six bits of 18)
X+ 	 */
X+ 
X+ 	bp->b_xmem = (sofub_base >> 10)&3;
X+ 	return(1);
X+ 	}
X+ 
X+ /*
X+  * sofub_relse	- release sofub_map
X+  *
X+  *	passed a buffer pointer and a transfer byte count...
X+  *	(for use if was a read)
X+  *
X+  *	note, we are called from the driver's interrupt service routine.
X+ */
X+ 
X+ sofub_relse(bp,count)
X+ register struct buf *bp;
X+ register unsigned count;
X+ 	{
X+ 	register int s;
X+ 	size_t uaddr;
X+ 	memaddr sbase;
X+ 	long	ebuf = E_UBUF;
X+ 	caddr_t	newaddr;
X+ 	u_int	newxmem;
X+ 
X+ /*
X+  * If the transfer was entirely below or above the 'bounce buffer' then 
X+  * this I/O request was done without the soft map being allocated.
X+ */
X+ 	if	(ebuf < ctob((long)sofub_base) || 
X+ 		 ebuf > ctob((long)sofub_base) + sofub_size)
X+ 		return;
X+ #ifdef	SOFUB_DEBUG
X+ 	if	(ebuf > QMEG)		/* Can't happen, transfer over 256kb */
X+ 		panic("sofub_relse");	
X+ #endif
X+ 
X+ /*
X+  * Next make sure that the I/O request is the one which currently has the
X+  * map allocated to it.
X+ */
X+ 	newaddr = (caddr_t)((sofub_addr << 6) | sofub_off);
X+ 	newxmem = ((u_int)sofub_addr >> 10) & 077;
X+ 
X+ 	if	(newaddr != bpadd ||  newxmem != bpxm)
X+ 		{
X+ #ifdef	SOFUB_DEBUG
X+ 		printf("sofub_relse: new %o:%o, old %o:%o\n",
X+ 			newxmem, newaddr, bpxm, bpadd);
X+ #endif
X+ 		bp->b_flags |= B_ERROR;
X+ 		bp->b_error = EFAULT;
X+ 		return;
X+ 		}
X+ 
X+ 	if	(bp->b_flags & B_READ)
X+ 		{
X+ 		uaddr = sofub_addr;
X+ 		sbase = sofub_base;
X+ 
X+ 		/*
X+ 		 * first, copy all 8kb-1click segments..
X+ 		 */
X+ 		s = spl5();
X+ 		while	(count > (8192-64))
X+ 			{
X+ 			copyv(sbase,0,uaddr,sofub_off,(8192-64));
X+ 			count -= (8192-64);
X+ 			uaddr += 0177;	/* add 8192-64 bytes */
X+ 			sbase += 0177;
X+ 			}
X+ 		/*
X+ 		 * copy last residual segment
X+ 		 */
X+ 		copyv(sbase,0,uaddr,sofub_off,count);
X+ 		splx(s);
X+ 		}
X+ 
X+ 	bp->b_un.b_addr = newaddr;
X+ 	bp->b_xmem = newxmem;
X+ 
X+ 	sofub_flags &= ~BUSY;
X+ 
X+ 	if	(sofub_flags & WANTED)
X+ 		{
X+ #ifdef	SOFUB_DEBUG
X+ 		printf("sofub_relse: wakeup\n");
X+ #endif
X+ 		sofub_flags &= ~WANTED;
X+ 		wakeup((caddr_t) &sofub_flags);
X+ 		}
X+ 	}
X+ #endif	/* SOFUB_MAP */
X*** /VERSION.old	Tue Nov 21 20:28:28 1995
X--- /VERSION	Mon Nov 27 20:03:08 1995
X***************
X*** 1,4 ****
X! Current Patch Level: 279
X  
X  2.11 BSD
X  ============
X--- 1,4 ----
X! Current Patch Level: 280
X  
X  2.11 BSD
X  ============
SHAR_EOF
chmod 644 '/tmp/patch.280'
fi
exit 0
#	End of shell archive