*** /old/src/sys/pdpuba/ra.c	Sun Jul  1 22:17:02 1990
--- /usr/src/sys/pdpuba/ra.c	Sun Jul 12 16:28:41 1992
***************
*** 3,43 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
   /***********************************************************************
-  *									*
   *			Copyright (c) 1983 by				*
   *		Digital Equipment Corporation, Maynard, MA		*
   *			All rights reserved.				*
-  *									*
   ***********************************************************************/
  
  /* 
!  * uda.c - UDA50A Driver
!  * 
!  * Date:        Jan  30 1984
   *
!  * This thing has been beaten beyound belief.  It still has two main problems:
   *
!  * When this device is on the same unibus as another DMA device
!  * like a versatec or a rk07, the Udstrat routine complains that it still
!  * has a buffered data path that it shouldn't.  I don't know why.
   *
!  * decvax!rich.
   *
   */
  
  /*
!  * RA MSCP disk device driver
!  *
!  * Should work with the following (at least!):
!  *	RUX1  (RX50, RX33)
!  * 	RQDX? (RD51, RD52, RD53, RD54)
!  *	UDA50 (RA60, RA80, RA81, RA82)
!  *	KLESI (RC25)
!  *
   * Tim Tucker, Gould Electronics, Sep 1985
   * Note:  This driver is based on the UDA50 4.3 BSD source.
   */
--- 3,67 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	2.2 (2.11BSD GTE) 7/11/92
   */
  
   /***********************************************************************
   *			Copyright (c) 1983 by				*
   *		Digital Equipment Corporation, Maynard, MA		*
   *			All rights reserved.				*
   ***********************************************************************/
  
  /* 
!  * ra.c - MSCP Driver
!  * Date:	Jul  1992
!  * Major rework of the partition tables.  Some old (RA60,80,81,RD53) tables 
!  * were retained (the rd54 'c' partition is now 'g' but the sizes stay 
!  * the same) for compatibility.  RC25, RD51, RA82 entries were removed (unlikely
!  * that the RA82 was used since the disktab entry was wrong).  A _brand new_
!  * scheme utilizing 5 "generic" partition tables was created based on the
!  * size of the disc.  This was needed due to the rapid proliferation of
!  * MSCP drive types, it was simply not feasible to have a 64 byte partition
!  * table for each of the (currently 28 to 30) types of MSCP discs.
   *
!  * More attention is paid to bits in the media id beyond the 7 bit 
!  * numeric id.  These bits can be used to distinquish between a RZ24 and a
!  * RZ24L for example.
   *
!  * Some of the diagnostic output was trimmed in an attempt to offset the
!  * growth of an already large drive.
   *
!  * Date:	Dec  18 1991
!  * The controller number (bits 6 and 7 of the minor device) were not
!  * being masked off after using dkunit().  This caused a crash when 
!  * the controller number was other than 0.
   *
+  * Date:	Sep  22 1991
+  * The read and write entries were removed as part of implementing the 
+  * common rawread and rawwrite routines.
+  * 
+  * Date:	Mar  16 1991
+  * The command packets were moved to an external heap which is dynamically
+  * allocated in a manner similar to m_ioget in the networking code.
+  * MSCP controllers used too much valuable kernel D space.  For UNIBUS
+  * machines sufficient UMRs were allocated to map the heap, removing the
+  * need to allocate a UMR per controller at open time.  This has the side
+  * effect of greatly simplifying the physical (Q22) or virtual (UMR) address 
+  * calculation of the command packets.  It also eliminates the need for
+  * 'struct buf racomphys', saving 24 bytes of D space.
+  *
+  * The error message output was rearranged saving another 82 bytes of
+  * kernel D space. Also, there was an extraneous buffer header allocated,
+  * it was removed, saving a further 24 bytes of D space.
+  * sms@wlv.imsd.contel.com
+  *
+  * Date:        Jan  30 1984
+  * This thing has been beaten beyound belief.
+  * decvax!rich.
   */
  
  /*
!  * MSCP disk device driver
   * Tim Tucker, Gould Electronics, Sep 1985
   * Note:  This driver is based on the UDA50 4.3 BSD source.
   */
***************
*** 52,65 ****
  #include "buf.h"
  #include "conf.h"
  #include "map.h"
  #include "uba.h"
  #include "rareg.h"
  #include "dk.h"
  #include "errno.h"
  
- #ifndef KDSA0
- #define	KDSA0				((u_short *)0172360)
- #endif
  #define	RACON(x)			((minor(x) >> 6) & 03)
  #define	RAUNIT(x)			((minor(x) >> 3) & 07)
  
--- 76,87 ----
  #include "buf.h"
  #include "conf.h"
  #include "map.h"
+ #include "syslog.h"
  #include "uba.h"
  #include "rareg.h"
  #include "dk.h"
  #include "errno.h"
  
  #define	RACON(x)			((minor(x) >> 6) & 03)
  #define	RAUNIT(x)			((minor(x) >> 3) & 07)
  
***************
*** 66,98 ****
  struct	rasizes	{
  	daddr_t nblocks;
  	daddr_t blkoff;
! }  ra25_sizes[8] = {
! 	15884,	0,		/* A=blk 0 thru 15883 */
! 	10032,	15884,		/* B=blk 15884 thru 25915 */
! 	-1,	25916,		/* C=blk 49324 thru 50901 */
! 	0,	0,		/* D=unused */
! 	0,	0,		/* E=unused */
! 	0,	0,		/* F=unused */
! 	0,	0,		/* G=unused */
! 	-1,	0,		/* H=blk 0 thru end */
! }, rd52_sizes[8] = { 		/* Setup for RX50, RD51, RD52 and RD53 disks */
  	9700,	0,		/* A=blk 0 thru 9699 (root for 52 & 53) */
  	17300,	9700,		/* B=blk 9700 thru 26999 (52 & 53 only) */
  	3100,	27000,		/* C=blk 27000 thru 30099 (swap 52 & 53) */
  	-1,	30100,		/* D=blk 30100 thru end (52 & 53 only) */
- 	7460,	0,		/* E=blk 0 thru 7459 (root 51) */
- 	2240,	7460,		/* F=blk 7460 thru 9699 (swap 51) */
- 	-1,	9700,		/* G=blk 9700 thru end (51, 52 & 53) */
- 	-1,	0,		/* H=blk 0 thru end (51, 52, 53 & RX50) */
- }, rd54_sizes[8] = {		/* Setup for RD54 disc */
- 	15884,	0,		/* A=blk 0 thru 15883 (root) */
- 	16720,	15884,		/* B=blk 15884 thru 32603 (swap) */
- 	-1,	32604,		/* C=blk 32604 thru end */
- 	0,	0,		/* D=unused */
  	0,	0,		/* E=unused */
  	0,	0,		/* F=unused */
! 	0,	0,		/* G=unused */
! 	-1,	0,		/* H=blk 0 thru end */
  }, ra60_sizes[8] = {
  	15884,	0,		/* A=blk 0 thru 15883 */
  	33440,	15884,		/* B=blk 15884 thru 49323 */
--- 88,102 ----
  struct	rasizes	{
  	daddr_t nblocks;
  	daddr_t blkoff;
! } rd52_sizes[8] = { 		/* Setup for RD52 and RD53 disks */
  	9700,	0,		/* A=blk 0 thru 9699 (root for 52 & 53) */
  	17300,	9700,		/* B=blk 9700 thru 26999 (52 & 53 only) */
  	3100,	27000,		/* C=blk 27000 thru 30099 (swap 52 & 53) */
  	-1,	30100,		/* D=blk 30100 thru end (52 & 53 only) */
  	0,	0,		/* E=unused */
  	0,	0,		/* F=unused */
! 	-1,	9700,		/* G=blk 9700 thru end (52 & 53) */
! 	-1,	0,		/* H=blk 0 thru end (52, 53) */
  }, ra60_sizes[8] = {
  	15884,	0,		/* A=blk 0 thru 15883 */
  	33440,	15884,		/* B=blk 15884 thru 49323 */
***************
*** 120,141 ****
  	-1,	565690,		/* F=blk 565690 thru end */
  	-1,	242606,		/* G=blk 242606 thru end */
  	-1,	0,		/* H=blk 0 thru end */
! }, ra82_sizes[8] ={
  	15884,	0,		/* A=blk 0 thru 15883 */
  	16720,	15884,		/* B=blk 15884 thru 32603 */
! 	303710,	32604,		/* C=blk 32604 thru 336313 */
! 	303710,	336314,		/* D=blk 336314 thru 640023 */
! 	303710,	640024,		/* E=blk 640024 thru 943733 */
! 	303710,	943734,		/* F=blk 943734 thru 1247443 */
  	0,	0,		/* G=unused */
! 	-1,	0,		/* H=blk 0 thru end */
  };
  
! #define RC_RCT	102		/* rc25 rct area */
! #define RD_RCT	32		/* # of sectors in remap area (don't touch) */
! #define RA_RCT	1000		/* Big ra disk rct area */
! /*------------------------------------------------------------------------*/
  
  #define	NRSPL2	3		/* log2 number of response packets */
  #define	NCMDL2	3		/* log2 number of command packets */
  #define	NRSP	(1<<NRSPL2)
--- 124,201 ----
  	-1,	565690,		/* F=blk 565690 thru end */
  	-1,	242606,		/* G=blk 242606 thru end */
  	-1,	0,		/* H=blk 0 thru end */
! }, ra_gen1[8] ={
  	15884,	0,		/* A=blk 0 thru 15883 */
+ 	8360,	15884,		/* B=blk 15884 thru 24243 */
+ 	-1,	0,		/* C=blk 0 thru end */
+ 	0,	0,		/* D=unused */
+ 	0,	0,		/* E=unused */
+ 	0,	0,		/* F=unused */
+ 	-1,	24244,		/* G=blk 24244 thru end */
+ 	0,	0,		/* H=unused */
+ }, ra_gen2[8] ={
+ 	15884,	0,		/* A=blk 0 thru 15883 */
  	16720,	15884,		/* B=blk 15884 thru 32603 */
! 	-1,	0,		/* C=blk 0 thru end */
! 	227136,	32604,		/* D=blk 32604 thru 259739 */
! 	-1,	259740,		/* E=blk 259740 thru end */
! 	0,	0,		/* F=unused */
! 	-1,	32604,		/* G=32604 thru end */
! 	0,	0,		/* H=unused */
! }, ra_gen3[8] ={
! 	-1,	0,		/* A=blk 0 thru end */
! 	0,	0,		/* B=unused */
! 	-1,	0,		/* C=blk 0 thru end */
! 	0,	0,		/* D=unused */
! 	0,	0,		/* E=unused */
! 	0,	0,		/* F=unused */
  	0,	0,		/* G=unused */
! 	0,	0,		/* H=unused */
! }, ra_gen4[8] ={
! 	15884,	0,		/* A=blk 0 thru 15883 */
! 	16720,	15884,		/* B=blk 15884 thru 32603 */
! 	-1,	0,		/* C=blk 0 thru end */
! 	227136,	32604,		/* D=blk 32604 thru 259739 */
! 	409600,	259740,		/* E=blk 259740 thru 669339 */
! 	-1,	669340,		/* F=blk 669340 thru end */
! 	-1,	32604,		/* G=blk 32604 thru end */
! 	0,	0,		/* H=unused */
! }, ra_gen5[8] ={
! 	15884,	0,		/* A=blk 0 thru 15883 */
! 	16720,	15884,		/* B=blk 15884 thru 32603 */
! 	-1,	0,		/* C=blk 0 thru end */
! 	227136,	32604,		/* D=blk 32604 thru 259739 */
! 	409600,	259740,		/* E=blk 259740 thru 669339 */
! 	182464,	669340,		/* F=blk 669340 thru 851803 */
! 	819200,	32604,		/* G=blk 32604 thru 851803 */
! 	-1,	851804,		/* H=blk 851804 thru end */
  };
  
! #define M15(a,b,c) ((((((a - '@') & 0x1f) << 10) | \
!                       ((b - '@') & 0x1f) <<  5) | \
!                       ((c - '@') & 0x1f) <<  0))
  
+ /*
+  * Entries are only placed in this table to over-ride the drive size
+  * based selection of partition tables in radisksetup().  For example:
+  * the RA81 is listed here to keep the "old" partition table rather than
+  * assigning 'ra_gen5' (because the RA81 is > 851804 sectors.
+ */
+ 
+ 	struct MEDIA
+ 		{
+ 		short	id7;
+ 		short	name15;
+ 		struct	rasizes *parts;
+ 		} Mscptbl[] = {
+ 	{ 81, M15('R','A','@'), ra81_sizes },
+ 	{ 60, M15('R','A','@'), ra60_sizes },
+ 	{ 80, M15('R','A','@'), ra80_sizes },
+ 	{ 53, M15('R','A','@'), rd52_sizes },
+ 	{ 52, M15('R','A','@'), rd52_sizes },
+ 	{ 0, 0, 0 }
+ 	};
+ 
  #define	NRSPL2	3		/* log2 number of response packets */
  #define	NCMDL2	3		/* log2 number of command packets */
  #define	NRSP	(1<<NRSPL2)
***************
*** 168,174 ****
  	struct raca	ra_ca;		/* communications area */
  	struct mscp	ra_rsp[NRSP];	/* response packets */
  	struct mscp	ra_cmd[NCMD];	/* command packets */
! } ra_comT;
  
  typedef	struct	ra_info	{
  	struct  rasizes	*ra_size;	/* Partion tables for drive */
--- 228,234 ----
  	struct raca	ra_ca;		/* communications area */
  	struct mscp	ra_rsp[NRSP];	/* response packets */
  	struct mscp	ra_cmd[NCMD];	/* command packets */
! } ra_comT;				/* 1096 bytes per controller */
  
  typedef	struct	ra_info	{
  	struct  rasizes	*ra_size;	/* Partion tables for drive */
***************
*** 175,181 ****
  	daddr_t		ra_dsize;	/* Max user size from online pkt */
  	short		ra_unit;	/* controller unit # */
  	struct	buf	ra_dtab;	/* I/O disk drive queues */
- 	struct	buf	ra_rtab;	/* raw I/O disk block header */
  } ra_infoT;
  
  typedef	struct	{
--- 235,240 ----
***************
*** 194,204 ****
  } ra_softcT;
  
  ra_softcT		ra_sc[NRAC];	/* Controller table */
! ra_comT			ra_com[NRAC];	/* Communications area table */
  ra_infoT		ra_disks[NRAD];	/* Disk table */
- static	struct	buf	racomphys;	/* Communications area phys map */
- struct	buf		ratab;		/* Interface queue (for bio) */
  
  #ifdef UCB_METER
  static	int		ra_dkn = -1;	/* number for iostat */
  #endif
--- 253,263 ----
  } ra_softcT;
  
  ra_softcT		ra_sc[NRAC];	/* Controller table */
! memaddr			ra_com[NRAC];	/* Communications area table */
  ra_infoT		ra_disks[NRAD];	/* Disk table */
  
+ #define	MAPSEGDESC	(((btoc(sizeof (ra_comT))-1)<<8)|RW)
+ 
  #ifdef UCB_METER
  static	int		ra_dkn = -1;	/* number for iostat */
  #endif
***************
*** 225,243 ****
  #define PRINTB(x)
  #endif
  
! int		raattach(), raintr();
! int		wakeup();
! long		raphys();
  struct	mscp 	*ragetcp();
  
  #define	b_qsize	b_resid		/* queue size per drive, in rqdtab */
  
  /*
!  * Setup root MSCP device (use standard address 0172150).
   */
! raroot()
  {
! 	raattach((radeviceT *)0172150, 0);
  }
  
  /*
--- 284,311 ----
  #define PRINTB(x)
  #endif
  
! int	raattach(), raintr(), wakeup();
! extern	ubadr_t	_iomap();
  struct	mscp 	*ragetcp();
  
  #define	b_qsize	b_resid		/* queue size per drive, in rqdtab */
  
  /*
!  * Setup root MSCP device (use bootcsr passed from ROMs).  In the event
!  * the system was not booted from a MSCP drive but swapdev is a MSCP drive
!  * we fake the old behaviour of attaching the first (172150) controller.  If
!  * the system was booted from a MSCP drive then this routine has already been
!  * called with the CSR of the booting controller and the attach routine will
!  * ignore further calls to attach controller 0.
!  *
!  * This whole thing is a hack and should go away somehow.
   */
! raroot(csr)
! 	register radeviceT *csr;
  {
! 	if (!csr)		/* XXX */
! 		csr = (radeviceT *) 0172150;	/* XXX */
! 	raattach(csr, 0);
  }
  
  /*
***************
*** 244,253 ****
   * Attach controller for autoconfig system.
   */
  raattach(addr, unit)
! 	radeviceT			*addr;
! 	int				unit;
  {
! 	register	ra_softcT	*sc = &ra_sc[unit];
  
  #ifdef UCB_METER
  	if (ra_dkn < 0)
--- 312,321 ----
   * Attach controller for autoconfig system.
   */
  raattach(addr, unit)
! 	register radeviceT *addr;
! 	register int	unit;
  {
! 	register ra_softcT *sc = &ra_sc[unit];
  
  #ifdef UCB_METER
  	if (ra_dkn < 0)
***************
*** 258,264 ****
  	if (sc->RAADDR == NULL && addr != NULL) {
  		sc->RAADDR = addr;
  		sc->sc_unit = unit;
! 		sc->sc_com = &ra_com[unit];
  		return(1);
  	}
  
--- 326,333 ----
  	if (sc->RAADDR == NULL && addr != NULL) {
  		sc->RAADDR = addr;
  		sc->sc_unit = unit;
! 		sc->sc_com = (ra_comT *)SEG5;
! 		ra_com[unit] = (memaddr)_ioget(sizeof (ra_comT));
  		return(1);
  	}
  
***************
*** 288,306 ****
   * Open a RA.  Initialize the device and set the unit online.
   */
  raopen(dev, flag)
! 	dev_t 				dev;
! 	int 				flag;
  {
! 	register	ra_infoT	*disk;
! 	register	struct	mscp	*mp;
! 	register	ra_softcT	*sc = &ra_sc[RACON(dev)];
! 	int				unit = RAUNIT(dev);
! 	int				s, i;
  
  	PRINTD(("raopen: dev=%x, flags=%d\n", dev, flag));
  
  	/* Check that controller exists */
! 	if (sc->RAADDR == NULL)
  		return(ENXIO);
  
  	/* Open device */
--- 357,375 ----
   * Open a RA.  Initialize the device and set the unit online.
   */
  raopen(dev, flag)
! 	dev_t 	dev;
! 	int 	flag;
  {
! 	register ra_infoT *disk;
! 	register struct	mscp *mp;
! 	register ra_softcT *sc = &ra_sc[RACON(dev)];
! 	int unit = RAUNIT(dev);
! 	int s, i;
  
  	PRINTD(("raopen: dev=%x, flags=%d\n", dev, flag));
  
  	/* Check that controller exists */
! 	if (RACON(dev) >= NRAC || sc->RAADDR == NULL)
  		return(ENXIO);
  
  	/* Open device */
***************
*** 332,342 ****
  	if ((disk = sc->sc_drives[unit]) == NULL) {
  		PRINTD(("raopen: opening new disk %d\n", unit));
  		s = splbio();
- 		while ((mp = ragetcp(sc)) == 0) {
- 			++sc->sc_cp_wait;
- 			sleep(&sc->sc_cp_wait, PSWP+1);
- 			--sc->sc_cp_wait;
- 		}
  		/* Allocate disk table entry for disk */
  		if ((disk = ragetdd()) != NULL) {
  			sc->sc_drives[unit] = disk;
--- 401,406 ----
***************
*** 343,361 ****
  			disk->ra_unit = unit;
  			disk->ra_dsize = -1L;
  		} else {
! 			printf("ra%d: out of disk data structures!\n", unit);
  			splx(s);
  			return(ENXIO);
  		}
! 
! 		/* Try to online disk unit */
  		mp->m_opcode = M_O_ONLIN;
  		mp->m_unit = unit;
  		mp->m_cmdref = (unsigned)&disk->ra_dsize;
  		((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
  		i = sc->RAADDR->raip;
! 		timeout(wakeup, (caddr_t)mp->m_cmdref, 10 * LINEHZ);
! 		sleep((caddr_t)mp->m_cmdref, PSWP+1);
  		splx(s);
  	}
  
--- 407,434 ----
  			disk->ra_unit = unit;
  			disk->ra_dsize = -1L;
  		} else {
! 			printf("ra%d: no disk structures\n", unit);
  			splx(s);
  			return(ENXIO);
  		}
! 	}
! 	/* Try to online disk unit, it might have gone offline */
! 	if (disk->ra_dsize == -1L) {
! 	/* In high kernel, don't saveseg5, just use normalseg5 later on. */
! 		while ((mp = ragetcp(sc)) == 0) {
! 			++sc->sc_cp_wait;
! 			sleep(&sc->sc_cp_wait, PSWP+1);
! 			--sc->sc_cp_wait;
! 		}
! 		mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  		mp->m_opcode = M_O_ONLIN;
  		mp->m_unit = unit;
  		mp->m_cmdref = (unsigned)&disk->ra_dsize;
  		((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
+ 		normalseg5();
  		i = sc->RAADDR->raip;
! 		timeout(wakeup, (caddr_t)&disk->ra_dsize, 10 * LINEHZ);
! 		sleep((caddr_t)&disk->ra_dsize, PSWP+1);
  		splx(s);
  	}
  
***************
*** 369,386 ****
  		return(ENXIO);
  	}
  	PRINTD(("raopen: disk online\n"));
- 
  	return(0);
  }
  
  /*
!  * Initialize a RA.  Initialize data structures, and start hardware
   * initialization sequence.
   */
  rainit(sc)
! 	register	ra_softcT	*sc;
  {
! 	long				racomaddr;
  
  	/*
  	 * Cold init of controller
--- 442,458 ----
  		return(ENXIO);
  	}
  	PRINTD(("raopen: disk online\n"));
  	return(0);
  }
  
  /*
!  * Initialize controller, data structures, and start hardware
   * initialization sequence.
   */
  rainit(sc)
! 	register ra_softcT *sc;
  {
! 	long	adr;
  
  	/*
  	 * Cold init of controller
***************
*** 392,419 ****
  	/*
  	 * Get physical address of RINGBASE
  	 */
- 	if (racomphys.b_flags == 0) {
- 		long rap = raphys((u_int)ra_com);
- 		racomphys.b_un.b_addr = (caddr_t)loint(rap);
- 		racomphys.b_xmem = hiint(rap);
- 		racomphys.b_bcount = sizeof(ra_com);
- 		racomphys.b_flags = B_PHYS;
- #ifdef UNIBUS_MAP
- 		mapalloc(&racomphys);
- #endif
- 		PRINTD(("rainit: racomphys b_addr=%o, b_xmem=%o\n",
- 			racomphys.b_un.b_addr, racomphys.b_xmem));
- 	}
- 	racomaddr =
- 		((u_int)racomphys.b_un.b_addr | ((long)racomphys.b_xmem << 16))
- 		+ sizeof(ra_comT) * sc->sc_unit
- 		+ (u_int)RINGBASE;
  
  	/*
  	 * Get individual controller RINGBASE physical address 
  	 */
! 	sc->sc_ctab.b_un.b_addr = (caddr_t)loint(racomaddr);
! 	sc->sc_ctab.b_xmem = hiint(racomaddr);
  	PRINTD(("rainit: com area addr low=0%o, high=0%o\n",
  		sc->sc_ctab.b_un.b_addr, sc->sc_ctab.b_xmem));
  
--- 464,477 ----
  	/*
  	 * Get physical address of RINGBASE
  	 */
  
+ 	adr = _iomap(ra_com[sc->sc_unit]) + RINGBASE;
+ 
  	/*
  	 * Get individual controller RINGBASE physical address 
  	 */
! 	sc->sc_ctab.b_un.b_addr = (caddr_t)loint(adr);
! 	sc->sc_ctab.b_xmem = hiint(adr);
  	PRINTD(("rainit: com area addr low=0%o, high=0%o\n",
  		sc->sc_ctab.b_un.b_addr, sc->sc_ctab.b_xmem));
  
***************
*** 435,467 ****
  	return(0);
  }
  
- /*
-  * Return the physical address corresponding to a virtual data space address.
-  * On a separate I&D CPU this is a noop, but it's only called when the first
-  * controller is initialized and on a dump.
-  */
- long
- raphys(vaddr)
- 	register	unsigned	vaddr;
- {
- 	register	unsigned	click;
- 
- 	click = (sep_id ? KDSA0 : KISA0)[(vaddr >> 13) & 07];
- 	return(((long)click << 6) + (vaddr & 017777));
- }
- 
  rastrategy(bp)
! 	register struct	buf 		*bp;
  {
! 	register ra_infoT		*disk;
! 	register struct buf 		*dp;
! 	ra_softcT			*sc = &ra_sc[RACON(bp->b_dev)];
! 	int 				part = minor(bp->b_dev) & 07;
! 	daddr_t 			sz, maxsz;
! 	int 				s;
  
  	/* Is disk online */
! 	if ((disk = sc->sc_drives[dkunit(bp)]) == NULL || disk->ra_dsize <= 0L)
  		goto bad;
  
  	/* Valid block in device partition */
--- 493,510 ----
  	return(0);
  }
  
  rastrategy(bp)
! 	register struct	buf *bp;
  {
! 	register ra_infoT *disk;
! 	register struct buf *dp;
! 	ra_softcT *sc = &ra_sc[RACON(bp->b_dev)];
! 	int part = minor(bp->b_dev) & 07;
! 	daddr_t sz, maxsz;
! 	int s;
  
  	/* Is disk online */
! 	if ((disk = sc->sc_drives[dkunit(bp) & 7]) == NULL || disk->ra_dsize <= 0L)
  		goto bad;
  
  	/* Valid block in device partition */
***************
*** 508,517 ****
  	if (sc->sc_ctab.b_active == 0) {
  		rastart(sc);
  	}
- 
  	splx(s);
  	return;
- 
  bad:
  	bp->b_flags |= B_ERROR;
  	iodone(bp);
--- 551,558 ----
***************
*** 518,576 ****
  	return;
  }
  
- ra_infoT	*
- rarawcheck(dev)
- 	register	dev_t 		dev;
- {
- 	register	ra_softcT	*sc;
- 	register	ra_infoT	*disk;
- 
- 	/* Check controller and disk unit */
- 	if (RACON(dev) >= NRAC || (sc = &ra_sc[RACON(dev)])->RAADDR == NULL
- 	    || (disk = sc->sc_drives[RAUNIT(dev)]) == NULL
- 	    || disk->ra_dsize <= 0L)
- 		return(NULL);
- 
- 	return(disk);
- }
- 
- raread(dev, uio)
- 	dev_t 	dev;
- 	struct	uio *uio;
- {
- 	register	ra_infoT	*disk;
- 
- 	/* Check controller and disk unit */
- 	if ((disk = rarawcheck(dev)) == NULL)
- 		return(ENXIO);
- 
- 	return(physio(rastrategy, &disk->ra_rtab, dev, B_READ, WORD, uio));
- }
- 
- rawrite(dev, uio)
- 	dev_t 	dev;
- 	struct	uio *uio;
- {
- 	register	ra_infoT	*disk;
- 
- 	/* Check controller and disk unit */
- 	if ((disk = rarawcheck(dev)) == NULL)
- 		return(ENXIO);
- 
- 	return(physio(rastrategy, &disk->ra_rtab, dev, B_WRITE, WORD, uio));
- }
- 
  /* Start i/o, must be called at level splbio */
  rastart(sc)
! 	register ra_softcT		*sc;
  {
! 	register struct mscp		*mp;
! 	register struct buf		*bp;
! 	struct buf			*dp;
! 	ra_infoT			*disk;
! 	int 				i;
! 	long				temp;
  
  loop:
  	/* 
  	 * Anything left to do on this controller?
--- 559,577 ----
  	return;
  }
  
  /* Start i/o, must be called at level splbio */
  rastart(sc)
! 	register ra_softcT *sc;
  {
! 	register struct mscp *mp;
! 	register struct buf *bp;
! 	struct buf *dp;
! 	ra_infoT *disk;
! 	int i;
! 	long	temp;
! 	segm	seg5;
  
+ 	saveseg5(seg5);		/* save it just once */
  loop:
  	/* 
  	 * Anything left to do on this controller?
***************
*** 582,588 ****
--- 583,591 ----
  		 * Check for response ring transitions lost in race
  		 * condition
  		 */
+ 		mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  		rarspring(sc);
+ 		restorseg5(seg5);
  		return(0);
  	}
  
***************
*** 601,619 ****
  	++sc->sc_ctab.b_active;
  	if (sc->RAADDR->rasa & RA_ERR || sc->sc_state != S_RUN) {
  		harderr(bp, "ra");
! 		printf("rasa %o, state %d\n", sc->RAADDR->rasa,
  			sc->sc_state);
  		/* Should requeue outstanding requests somehow */
  		rainit(sc);
  		return(0);
  	}
  
  	/* Issue command */
  	if ((mp = ragetcp(sc)) == NULL)
! 		return(0);
  	mp->m_cmdref = (unsigned)bp;	/* pointer to get back */
  	mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE;
! 	mp->m_unit = dkunit(bp);
  	disk = sc->sc_drives[mp->m_unit];
  	temp = bp->b_blkno + disk->ra_size[minor(bp->b_dev) & 7].blkoff;
  	mp->m_lbn_l = loint(temp);
--- 604,625 ----
  	++sc->sc_ctab.b_active;
  	if (sc->RAADDR->rasa & RA_ERR || sc->sc_state != S_RUN) {
  		harderr(bp, "ra");
! 		log(LOG_INFO, "rasa %o state %d\n", sc->RAADDR->rasa,
  			sc->sc_state);
  		/* Should requeue outstanding requests somehow */
  		rainit(sc);
+ out:
+ 		restorseg5(seg5);
  		return(0);
  	}
  
  	/* Issue command */
+ 	mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  	if ((mp = ragetcp(sc)) == NULL)
! 		goto out;
  	mp->m_cmdref = (unsigned)bp;	/* pointer to get back */
  	mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE;
! 	mp->m_unit = dkunit(bp) & 7;
  	disk = sc->sc_drives[mp->m_unit];
  	temp = bp->b_blkno + disk->ra_size[minor(bp->b_dev) & 7].blkoff;
  	mp->m_lbn_l = loint(temp);
***************
*** 626,632 ****
  		mp->m_bytecnt, mp->m_buf_h, mp->m_buf_l));
  	((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
  	if (sc->RAADDR->rasa & RA_ERR)
! 		printf("ra: Error %d\n", sc->RAADDR->rasa);
  	i = sc->RAADDR->raip;		/* initiate polling */
  
  #ifdef UCB_METER
--- 632,638 ----
  		mp->m_bytecnt, mp->m_buf_h, mp->m_buf_l));
  	((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
  	if (sc->RAADDR->rasa & RA_ERR)
! 		printf("ra: Err %d\n", sc->RAADDR->rasa);
  	i = sc->RAADDR->raip;		/* initiate polling */
  
  #ifdef UCB_METER
***************
*** 669,682 ****
  raintr(unit)
  	int				unit;
  {
! 	register	ra_softcT	*sc = &ra_sc[unit];
! 	register	struct	mscp	*mp;
! 	register	struct	buf	*bp;
! 	u_int				i;
  
  	PRINTD(("raintr%d: state %d, rasa %o\n", unit, sc->sc_state,
  		sc->RAADDR->rasa));
  
  	switch (sc->sc_state) {
  	case S_STEP1:
  #define	STEP1MASK	0174377
--- 675,691 ----
  raintr(unit)
  	int				unit;
  {
! 	register ra_softcT *sc = &ra_sc[unit];
! 	register struct	mscp *mp;
! 	register struct	buf *bp;
! 	u_int i;
! 	segm seg5;
  
  	PRINTD(("raintr%d: state %d, rasa %o\n", unit, sc->sc_state,
  		sc->RAADDR->rasa));
  
+ 	saveseg5(seg5);		/* save it just once */
+ 
  	switch (sc->sc_state) {
  	case S_STEP1:
  #define	STEP1MASK	0174377
***************
*** 722,727 ****
--- 731,737 ----
  		/*
  		 * Initialize the data structures.
  		 */
+ 		mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  		ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, sc->sc_com->ra_rsp,
  			0, NRSP, RA_INT | RA_OWN);
  		ramsginit(sc, sc->sc_com->ra_ca.ca_cmd, sc->sc_com->ra_cmd,
***************
*** 736,741 ****
--- 746,752 ----
  		mp->m_cntflgs = M_C_ATTN | M_C_MISC | M_C_THIS;	
  		((Trl *)mp->m_dscptr)->hsh |= RA_OWN|RA_INT;
  		i = sc->RAADDR->raip;
+ 		restorseg5(seg5);
  		return;
  
  	case S_SCHAR:
***************
*** 743,750 ****
  		break;
  
  	default:
! 		printf("ra: interrupt in unknown state %d ignored\n",
! 			sc->sc_state);
  		return;
  	}
  
--- 754,760 ----
  		break;
  
  	default:
! 		printf("raintr: state %d ignored\n", sc->sc_state);
  		return;
  	}
  
***************
*** 752,763 ****
  	 * If this happens we are in BIG trouble!
  	 */
  	if (sc->RAADDR->rasa & RA_ERR) {
! 		printf("ra: fatal error (%o)\n", sc->RAADDR->rasa);
  		sc->sc_state = S_IDLE;
  		sc->sc_ctab.b_active = 0;
  		wakeup((caddr_t)&sc->sc_ctab);
  	}
  
  	/*
  	 * Check for buffer purge request
  	 */
--- 762,775 ----
  	 * If this happens we are in BIG trouble!
  	 */
  	if (sc->RAADDR->rasa & RA_ERR) {
! 		printf("ra: fatal err %o\n", sc->RAADDR->rasa);
  		sc->sc_state = S_IDLE;
  		sc->sc_ctab.b_active = 0;
  		wakeup((caddr_t)&sc->sc_ctab);
  	}
  
+ 	mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
+ 
  	/*
  	 * Check for buffer purge request
  	 */
***************
*** 782,793 ****
  		sc->sc_com->ra_ca.ca_cmdint = 0;
  	}
  
! 	/*
! 	 * Waiting for command?
! 	 */
  	if (sc->sc_cp_wait)
  		wakeup((caddr_t)&sc->sc_cp_wait);
- 
  	rastart(sc);
  }
  
--- 794,804 ----
  		sc->sc_com->ra_ca.ca_cmdint = 0;
  	}
  
! 	restorseg5(seg5);
! 
! 	/* Waiting for command? */
  	if (sc->sc_cp_wait)
  		wakeup((caddr_t)&sc->sc_cp_wait);
  	rastart(sc);
  }
  
***************
*** 795,815 ****
   * Init mscp communications area
   */
  ramsginit(sc, com, msgs, offset, length, flags)
! 	register	ra_softcT	*sc;
! 	register	Trl		*com;
! 	register	struct mscp	*msgs;
! 	int				offset;
! 	int				length;
! 	int				flags;
  {
! 	long				vaddr;
  
  	/* 
! 	 * Figure out virtual address of message 
  	 * skip comm area and mscp messages header and previous messages
  	 */
! 	vaddr = (u_int)racomphys.b_un.b_addr | ((long)racomphys.b_xmem << 16);
! 	vaddr += (u_int)sc->sc_com - (u_int)ra_com;	/* unit offset */
  	vaddr += sizeof(struct raca)			/* skip comm area */
  		+sizeof(struct mscp_header);		/* m_cmdref disp */
  	vaddr += offset * sizeof(struct mscp);		/* skip previous */
--- 806,823 ----
   * Init mscp communications area
   */
  ramsginit(sc, com, msgs, offset, length, flags)
! 	register ra_softcT	*sc;
! 	register Trl		*com;
! 	register struct mscp	*msgs;
! 	int offset, length, flags;
  {
! 	long	vaddr;
  
  	/* 
! 	 * Figure out Unibus or physical(Q22) address of message 
  	 * skip comm area and mscp messages header and previous messages
  	 */
! 	vaddr = _iomap(ra_com[sc->sc_unit]);		/* base adr in heap */
  	vaddr += sizeof(struct raca)			/* skip comm area */
  		+sizeof(struct mscp_header);		/* m_cmdref disp */
  	vaddr += offset * sizeof(struct mscp);		/* skip previous */
***************
*** 829,839 ****
  ragetcp(sc)
  	register ra_softcT	*sc;
  {
! 	register struct	mscp	*mp;
! 	register int 		i;
! 	int			s;
  
  	s = splbio();
  	i = sc->sc_lastcmd;
  	if ((sc->sc_com->ra_ca.ca_cmd[i].hsh & (RA_OWN|RA_INT)) == RA_INT
  	    && sc->sc_credits >= 2) {
--- 837,850 ----
  ragetcp(sc)
  	register ra_softcT	*sc;
  {
! 	register struct	mscp	*mp = NULL;
! 	register int i;
! 	int s;
! 	segm seg5;
  
  	s = splbio();
+ 	saveseg5(seg5);
+ 	mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  	i = sc->sc_lastcmd;
  	if ((sc->sc_com->ra_ca.ca_cmd[i].hsh & (RA_OWN|RA_INT)) == RA_INT
  	    && sc->sc_credits >= 2) {
***************
*** 842,858 ****
  		mp = &sc->sc_com->ra_cmd[i];
  		ramsgclear(mp);
  		sc->sc_lastcmd = (i + 1) % NCMD;
- 		splx(s);
- 		return(mp);
  	}
! 
  	splx(s);
! 	return(NULL);
  }
  
  /* Clear a mscp command packet */
  ramsgclear(mp)
! 	register	struct	mscp	*mp;
  {
  	mp->m_unit = mp->m_modifier = mp->m_flags = 
  		mp->m_bytecnt = mp->m_buf_l = mp->m_buf_h = 
--- 853,867 ----
  		mp = &sc->sc_com->ra_cmd[i];
  		ramsgclear(mp);
  		sc->sc_lastcmd = (i + 1) % NCMD;
  	}
! 	restorseg5(seg5);
  	splx(s);
! 	return(mp);
  }
  
  /* Clear a mscp command packet */
  ramsgclear(mp)
! 	register struct	mscp *mp;
  {
  	mp->m_unit = mp->m_modifier = mp->m_flags = 
  		mp->m_bytecnt = mp->m_buf_l = mp->m_buf_h = 
***************
*** 862,870 ****
  
  /* Scan for response messages */
  rarspring(sc)
! 	register	ra_softcT	*sc;
  {
! 	register	int		i;
  
  	sc->sc_com->ra_ca.ca_rspint = 0;
  	i = sc->sc_lastrsp; 
--- 871,879 ----
  
  /* Scan for response messages */
  rarspring(sc)
! 	register ra_softcT *sc;
  {
! 	register int i;
  
  	sc->sc_com->ra_ca.ca_rspint = 0;
  	i = sc->sc_lastrsp; 
***************
*** 883,895 ****
   * Process a response packet
   */
  rarsp(mp, sc)
! 	register	struct	mscp	*mp;
! 	register	ra_softcT	*sc;
  {
! 	register	struct	buf 	*dp;
! 	struct	buf			*bp;
! 	ra_infoT			*disk;
! 	int 				st;
  
  	/*
  	 * Reset packet length and check controller credits
--- 892,904 ----
   * Process a response packet
   */
  rarsp(mp, sc)
! 	register struct	mscp *mp;
! 	register ra_softcT *sc;
  {
! 	register struct	buf *dp;
! 	struct buf *bp;
! 	ra_infoT *disk;
! 	int st;
  
  	/*
  	 * Reset packet length and check controller credits
***************
*** 912,918 ****
  	 * The controller interrupts as drive ZERO so check for it first.
  	 */
  	st = mp->m_status & M_S_MASK;
! 	if ((mp->m_opcode & 0xff) == (M_O_STCON|M_O_END)) {
  		if (st == M_S_SUCC)
  			sc->sc_state = S_RUN;
  		else
--- 921,927 ----
  	 * The controller interrupts as drive ZERO so check for it first.
  	 */
  	st = mp->m_status & M_S_MASK;
! 	if (mp->m_opcode == (M_O_STCON|M_O_END)) {
  		if (st == M_S_SUCC)
  			sc->sc_state = S_RUN;
  		else
***************
*** 925,934 ****
  	/*
  	 * Check drive and then decode response and take action.
  	 */
! 	switch (mp->m_opcode & 0xff) {
  	case M_O_ONLIN|M_O_END:
  		if ((disk = sc->sc_drives[mp->m_unit]) == NULL) {
! 			printf("ra: couldn't ONLINE disk!\n");
  			break;
  		}
  		dp = &disk->ra_dtab;
--- 934,943 ----
  	/*
  	 * Check drive and then decode response and take action.
  	 */
! 	switch (mp->m_opcode) {
  	case M_O_ONLIN|M_O_END:
  		if ((disk = sc->sc_drives[mp->m_unit]) == NULL) {
! 			printf("ra: couldn't ONLINE disk\n");
  			break;
  		}
  		dp = &disk->ra_dtab;
***************
*** 963,969 ****
  		/* it went offline and we didn't notice */
  		PRINTD(("ra%d: unit %d attention\n", sc->sc_unit, mp->m_unit));
  		if ((disk = sc->sc_drives[mp->m_unit]) != NULL)
! 			disk->ra_dsize = 0;
  		break;
  
  	case M_O_END:
--- 972,978 ----
  		/* it went offline and we didn't notice */
  		PRINTD(("ra%d: unit %d attention\n", sc->sc_unit, mp->m_unit));
  		if ((disk = sc->sc_drives[mp->m_unit]) != NULL)
! 			disk->ra_dsize = -1L;
  		break;
  
  	case M_O_END:
***************
*** 975,984 ****
  	case M_O_READ | M_O_END:
  	case M_O_WRITE | M_O_END:
  		/* normal termination of read/write request */
! 		if ((disk = sc->sc_drives[mp->m_unit]) == NULL) {
! 			printf("ra: r/w no disk table entry\n");
  			break;
- 		}
  		bp = (struct buf *)mp->m_cmdref;
  
  		/*
--- 984,991 ----
  	case M_O_READ | M_O_END:
  	case M_O_WRITE | M_O_END:
  		/* normal termination of read/write request */
! 		if ((disk = sc->sc_drives[mp->m_unit]) == NULL)
  			break;
  		bp = (struct buf *)mp->m_cmdref;
  
  		/*
***************
*** 996,1016 ****
  		}
  #endif
  		if (st == M_S_OFFLN || st == M_S_AVLBL) {
! 			/* 
! 			 * mark unit offline 
! 			 */
  			disk->ra_dsize = -1L;
  
! 			/*
! 			 * Link the buffer onto the front of the drive queue
! 			 */
  			if ((bp->av_forw = dp->b_actf) == 0)
  				dp->b_actl = bp;
  			dp->b_actf = bp;
  
! 			/*
! 			 * Link the drive onto the controller queue
! 			 */
  			if (dp->b_active == 0) {
  				dp->b_forw = NULL;
  				if (sc->sc_ctab.b_actf == NULL)
--- 1003,1017 ----
  		}
  #endif
  		if (st == M_S_OFFLN || st == M_S_AVLBL) {
! 			/* mark unit offline */
  			disk->ra_dsize = -1L;
  
! 			/* Link the buffer onto the front of the drive queue */
  			if ((bp->av_forw = dp->b_actf) == 0)
  				dp->b_actl = bp;
  			dp->b_actf = bp;
  
! 			/* Link the drive onto the controller queue */
  			if (dp->b_active == 0) {
  				dp->b_forw = NULL;
  				if (sc->sc_ctab.b_actf == NULL)
***************
*** 1024,1030 ****
  		}
  		if (st != M_S_SUCC) {
  			harderr(bp, "ra");
! 			printf("status %o\n", mp->m_status);
  			bp->b_flags |= B_ERROR;
  		}
  		bp->b_resid = bp->b_bcount - mp->m_bytecnt;
--- 1025,1031 ----
  		}
  		if (st != M_S_SUCC) {
  			harderr(bp, "ra");
! 			log(LOG_INFO, "status %o\n", mp->m_status);
  			bp->b_flags |= B_ERROR;
  		}
  		bp->b_resid = bp->b_bcount - mp->m_bytecnt;
***************
*** 1035,1046 ****
  		break;
  
  	default:
! 		printf("ra: unknown packet opcode=0%o\n", mp->m_opcode & 0xff);
  		ra_error((caddr_t)mp);
  	}
  }
  
- 
  /*
   * Init disk info structure from data in mscp packet
   */
--- 1036,1046 ----
  		break;
  
  	default:
! 		log(LOG_INFO,"ra: opcode %o\n", mp->m_opcode);
  		ra_error((caddr_t)mp);
  	}
  }
  
  /*
   * Init disk info structure from data in mscp packet
   */
***************
*** 1048,1110 ****
  	register	ra_infoT	*disk;
  	register	struct	mscp	*mp;
  {
  	/* Get unit total block count */
  	disk->ra_dsize = mp->m_uslow + ((long)mp->m_ushigh << 16);
- 	PRINTD(("ra%d: online, total size=%D, id=%d, rctsize=%d\n",
- 	      mp->m_unit, disk->ra_dsize, hiint(mp->m_mediaid) & 0xff,
- 	      mp->m_rctsize));
  
  	/* 
! 	 * Get disk type and from that partition structure.  Adjust
! 	 * disk size to reflect revector and maint area.
  	 */
! 	switch (hiint(mp->m_mediaid) & 0xff) {
! 		case 25:/* RC25 removable */
! 			disk->ra_size = ra25_sizes;
! 			disk->ra_dsize -= RC_RCT;
! 			break;
! 		case 33:/* RX33 Floppy disk */
! 		case 50:/* RX50 Floppy disk */
! 			disk->ra_size = rd52_sizes;
! 			break;
! 		case 51:
! 		case 52:/* RD Hard disks */
! 		case 53:
! 			disk->ra_size = rd52_sizes;
! 			disk->ra_dsize -= RD_RCT;
! 			break;
! 		case 54:
! 			disk->ra_size = rd54_sizes;
! 			disk->ra_dsize -= RD_RCT;
! 			break;
! 		case 60:/* RA Hard disks */
! 			disk->ra_size = ra60_sizes;
! 			disk->ra_dsize -= RA_RCT;
! 			break;
! 		case 80:
! 			disk->ra_size = ra80_sizes;
! 			disk->ra_dsize -= RA_RCT;
! 			break;
! 		case 81:
! 			disk->ra_size = ra81_sizes;
! 			disk->ra_dsize -= RA_RCT;
! 			break;
! 		case 82:
! 			disk->ra_size = ra82_sizes;
! 			disk->ra_dsize -= RA_RCT;
! 			break;
! 		default:
! 			printf("ra: disk type %d unknown\n",
! 				hiint(mp->m_mediaid) & 0xff);
! 	}
  }
  
  /*
   * Process an error log message
   *
   * For now, just log the error on the console.  Only minimal decoding is done,
   * only "useful" information is printed.  Eventually should send message to
!  * an error logger.
   */
  ra_error(mp)
  	register struct mslg *mp;
--- 1048,1135 ----
  	register	ra_infoT	*disk;
  	register	struct	mscp	*mp;
  {
+ 	register struct MEDIA *tp;
+ 	int	nameid, numid, i;
+ 	daddr_t	blks;
+ 
+ 	nameid = (((loint(mp->m_mediaid) & 0x3f) << 9) | 
+ 		   ((hiint(mp->m_mediaid) >> 7) & 0x1ff));
+ 	numid = hiint(mp->m_mediaid) & 0x7f;
+ 
  	/* Get unit total block count */
  	disk->ra_dsize = mp->m_uslow + ((long)mp->m_ushigh << 16);
  
+ 	/* spill the beans about what we have brought online */
+ 	log(LOG_NOTICE, "ra%d: %c%c%d%c size=%D id: %X\n", mp->m_unit,
+ 		mx(nameid,2), mx(nameid,1), numid, mx(nameid,0), 
+ 		disk->ra_dsize, mp->m_mediaid);
+ 
  	/* 
! 	 * Look for override in the table, if found use the partition
! 	 * table specified.  Else use a size based rule for assigning on
! 	 * of the 5 general purpose tables.
  	 */
! 
! 	for	(blks = disk->ra_dsize, tp = Mscptbl; tp->id7; tp++)
! 		{
! 		if	(tp->id7 == numid && tp->name15 == nameid)
! 			{
! 			disk->ra_size = tp->parts;
! 			log(LOG_NOTICE, "ra%d: old table\n", mp->m_unit);
! 			return;
! 			}
! 		}
! 	if	(blks < 24244L)
! 		{
! 		i = 3;			/* < ~12mb = type 3 */
! 		disk->ra_size = ra_gen3;
! 		}
! 	else if	(blks < 259740L)
! 		{
! 		i = 1;			/* < ~112mb = type 1 */
! 		disk->ra_size = ra_gen1;
! 		}
! 	else if	(blks < 669340L)	/* < ~330mb = type 2 */
! 		{
! 		i = 2;
! 		disk->ra_size = ra_gen2;
! 		}
! 	else if	(blks < 851804L)	/* < ~420mb = type 4 */
! 		{
! 		i = 4;
! 		disk->ra_size = ra_gen4;
! 		}
! 	else
! 		{
! 		i = 5;			/* > ~420mb = type 5 */
! 		disk->ra_size = ra_gen5;
! 		}
! 	log(LOG_NOTICE, "ra%d: type %d partitions\n", mp->m_unit, i);
  }
  
  /*
+  * this is a routine rather than a macro to save space - shifting, etc 
+  * generates a lot of code.
+ */
+ 
+ mx(l, i)
+ 	int l, i;
+ 	{
+ 	register int c;
+ 
+ 	c = (l >> (5 * i)) & 0x1f;
+ 	if	(c == 0)
+ 		c = ' ' - '@';
+ 	return(c + '@');
+ 	}
+ 
+ /*
   * Process an error log message
   *
   * For now, just log the error on the console.  Only minimal decoding is done,
   * only "useful" information is printed.  Eventually should send message to
!  * an error logger.  At least 90 bytes of D space were saved without losing
!  * functionality.
   */
  ra_error(mp)
  	register struct mslg *mp;
***************
*** 1114,1147 ****
  
  	switch (mp->me_format) {
  	case M_F_CNTERR:
! 		printf("controller error, event 0%o\n", mp->me_event);
  		break;
- 
  	case M_F_BUSADDR:
! 		printf("host memory access error, event 0%o, addr 0%o\n",
! 			mp->me_event, mp->me_busaddr);
  		break;
- 
  	case M_F_DISKTRN:
! 		printf("disk transfer error, unit %d, grp 0x%x, hdr 0x%x\n",
  			mp->me_unit, mp->me_group, mp->me_hdr);
  		break;
- 
  	case M_F_SDI:
! 		printf("SDI error, unit %d, event 0%o, hdr 0x%x\n",
! 			mp->me_unit, mp->me_event, mp->me_hdr);
  		break;
- 
  	case M_F_SMLDSK:
! 		printf("small disk error, unit %d, event 0%o, cyl %d\n",
! 			mp->me_unit, mp->me_event, mp->me_sdecyl);
  		break;
- 
  	default:
! 		printf("unknown error, unit %d, format 0%o, event 0%o\n",
! 			mp->me_unit, mp->me_format, mp->me_event);
  	}
  
  #ifdef RADEBUG
  	/* If error debug on, do hex dump */
  	{
--- 1139,1165 ----
  
  	switch (mp->me_format) {
  	case M_F_CNTERR:
! 		printf("ctlr");
  		break;
  	case M_F_BUSADDR:
! 		printf("M_F_BUSADDR %o", mp->me_busaddr);
  		break;
  	case M_F_DISKTRN:
! 		printf("disk xfer, unit %d grp x%x hdr x%x",
  			mp->me_unit, mp->me_group, mp->me_hdr);
  		break;
  	case M_F_SDI:
! 		printf("SDI unit %d hdr x%x", mp->me_unit, mp->me_hdr);
  		break;
  	case M_F_SMLDSK:
! 		printf("small disk unit %d cyl %d", mp->me_unit, mp->me_sdecyl);
  		break;
  	default:
! 		printf("?, unit %d format %o",mp->me_unit,mp->me_format);
  	}
  
+ 	printf(", event 0%o\n", mp->me_event);
+ 
  #ifdef RADEBUG
  	/* If error debug on, do hex dump */
  	{
***************
*** 1165,1181 ****
  radump(dev)
  	dev_t dev;
  {
! 	register ra_softcT		*sc;
! 	register ra_infoT		*disk;
! 	register struct mscp 		*mp;
! 	struct mscp 			*racmd();
! 	daddr_t				bn, dumpsize;
! 	long 				paddr, maddr;
! 	int	 			count;
  #ifdef	UNIBUS_MAP
! 	struct ubmap 			*ubp;
  #endif
! 	int 				unit, partition;
  
  	/* paranoia, space hack */
  	disk = ra_disks;
--- 1183,1200 ----
  radump(dev)
  	dev_t dev;
  {
! 	register ra_softcT *sc;
! 	register ra_infoT *disk;
! 	register struct mscp *mp;
! 	struct mscp *racmd();
! 	daddr_t	bn, dumpsize;
! 	long paddr, maddr;
! 	int count;
  #ifdef	UNIBUS_MAP
! 	struct ubmap *ubp;
  #endif
! 	int 	unit, partition;
! 	segm	seg5;
  
  	/* paranoia, space hack */
  	disk = ra_disks;
***************
*** 1186,1208 ****
  		return(EINVAL);
  
  	/* Init RA controller */
! 	paddr = raphys((u_int)ra_com);
! 	racomphys.b_un.b_addr = (caddr_t)loint(paddr);
! 	racomphys.b_xmem = hiint(paddr);
  #ifdef	UNIBUS_MAP
  	if (ubmap) {
  		ubp = UBMAP;
! 		ubp->ub_lo = loint(racomphys.b_un.b_addr);
! 		ubp->ub_hi = hiint(racomphys.b_xmem);
! 		racomphys.b_un.b_addr = racomphys.b_xmem = 0;
  	}
  #endif
  
  	/* Get communications area and clear out packets */
! 	paddr = (u_int)racomphys.b_un.b_addr
! 		+ ((long)racomphys.b_xmem << 16)
! 		+ (u_int)RINGBASE;
! 	sc->sc_com = ra_com;
  	mp = sc->sc_com->ra_rsp;
  	sc->sc_com->ra_ca.ca_cmdint = sc->sc_com->ra_ca.ca_rspint = 0;
  	bzero((caddr_t)mp, 2 * sizeof(*mp));
--- 1205,1223 ----
  		return(EINVAL);
  
  	/* Init RA controller */
! 	paddr = _iomap(ra_com[sc->sc_unit]);
  #ifdef	UNIBUS_MAP
  	if (ubmap) {
  		ubp = UBMAP;
! 		ubp->ub_lo = loint(paddr);
! 		ubp->ub_hi = hiint(paddr);
  	}
  #endif
  
  	/* Get communications area and clear out packets */
! 	paddr += RINGBASE;
! 	saveseg5(seg5);
! 	mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  	mp = sc->sc_com->ra_rsp;
  	sc->sc_com->ra_ca.ca_cmdint = sc->sc_com->ra_ca.ca_rspint = 0;
  	bzero((caddr_t)mp, 2 * sizeof(*mp));
***************
*** 1221,1230 ****
  	while ((sc->RAADDR->rasa & RA_STEP4) == 0)
  		/*void*/;
  	sc->RAADDR->rasa = RA_GO;
- 	sc->sc_unit = 0;
  	ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, mp, 0, 2, 0);
  	if (!racmd(M_O_STCON, unit, sc)) {
! 		PRINTB(("radump: failed to stat controller\n"));
  		return(EFAULT);
  	}
  	PRINTB(("radump: controller up ok\n"));
--- 1236,1244 ----
  	while ((sc->RAADDR->rasa & RA_STEP4) == 0)
  		/*void*/;
  	sc->RAADDR->rasa = RA_GO;
  	ramsginit(sc, sc->sc_com->ra_ca.ca_rsp, mp, 0, 2, 0);
  	if (!racmd(M_O_STCON, unit, sc)) {
! 		PRINTB(("radump: failed to start controller\n"));
  		return(EFAULT);
  	}
  	PRINTB(("radump: controller up ok\n"));
***************
*** 1278,1301 ****
  
  		paddr += (DBSIZE << PGSHIFT);
  	}
! 
  	return(0);
  }
  
  struct	mscp	*
  racmd(op, unit, sc)
! 	int 				op, unit;
! 	register	ra_softcT	*sc;
  {
! 	register	struct mscp 	*cmp, *rmp;
! 	Trl				*rlp;
! 	int 				i;
  
  	cmp = &sc->sc_com->ra_rsp[1];
  	rmp = &sc->sc_com->ra_rsp[0];
  	rlp = &sc->sc_com->ra_ca.ca_rsp[0];
  	cmp->m_opcode = op;
! 	cmp->m_unit = unit & 7;
  	cmp->m_header.ra_msglen = rmp->m_header.ra_msglen = sizeof(struct mscp);
  	rlp[0].hsh &= ~RA_INT;
  	rlp[1].hsh &= ~RA_INT;
--- 1292,1315 ----
  
  		paddr += (DBSIZE << PGSHIFT);
  	}
! 	restorseg5(seg5);
  	return(0);
  }
  
  struct	mscp	*
  racmd(op, unit, sc)
! 	int op, unit;
! 	register ra_softcT *sc;
  {
! 	register struct mscp *cmp, *rmp;
! 	Trl *rlp;
! 	int i;
  
  	cmp = &sc->sc_com->ra_rsp[1];
  	rmp = &sc->sc_com->ra_rsp[0];
  	rlp = &sc->sc_com->ra_ca.ca_rsp[0];
  	cmp->m_opcode = op;
! 	cmp->m_unit = unit;
  	cmp->m_header.ra_msglen = rmp->m_header.ra_msglen = sizeof(struct mscp);
  	rlp[0].hsh &= ~RA_INT;
  	rlp[1].hsh &= ~RA_INT;
***************
*** 1310,1316 ****
  		/*void*/;
  	sc->sc_com->ra_ca.ca_rspint = 0;
  	sc->sc_com->ra_ca.ca_cmdint = 0;
! 	if ((rmp->m_opcode & 0xff) != (op | M_O_END)
  	    || (rmp->m_status & M_S_MASK) != M_S_SUCC) {
  		ra_error(unit, rmp);
  		return(0);
--- 1324,1330 ----
  		/*void*/;
  	sc->sc_com->ra_ca.ca_rspint = 0;
  	sc->sc_com->ra_ca.ca_cmdint = 0;
! 	if (rmp->m_opcode != (op | M_O_END)
  	    || (rmp->m_status & M_S_MASK) != M_S_SUCC) {
  		ra_error(unit, rmp);
  		return(0);
*** /old/src/sys/pdpuba/rk.c	Tue Apr  3 13:32:23 1990
--- /usr/src/sys/pdpuba/rk.c	Sun Sep 22 08:40:33 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rk.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rk.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 26,32 ****
  struct	rkdevice *RKADDR;
  
  struct	buf	rktab;
- struct	buf	rrkbuf[NRK];
  
  #define	rkunit(dev)	minor(dev)
  
--- 26,31 ----
***************
*** 166,184 ****
  	bp->b_resid = -(rkaddr->rkwc << 1);
  	iodone(bp);
  	rkstart();
- }
- 
- rkread(dev, uio)
- 	register dev_t dev;
- 	struct	uio *uio;
- {
- 	return (physio(rkstrategy, &rrkbuf[rkunit(dev)], dev, B_READ, WORD, uio));
- }
- 
- rkwrite(dev, uio)
- 	register dev_t dev;
- 	struct	uio *uio;
- {
- 	return (physio(rkstrategy, &rrkbuf[rkunit(dev)], dev, B_WRITE, WORD, uio));
  }
  #endif NRK
--- 165,169 ----
*** /old/src/sys/pdpuba/rl.c	Tue Apr  3 13:26:00 1990
--- /usr/src/sys/pdpuba/rl.c	Sun Sep 22 08:41:02 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rl.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rl.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 32,38 ****
  
  struct	rldevice *RLADDR;
  
! struct	buf	rrlbuf[NRL];	/* Raw header for each drive */
  struct	buf	rlutab[NRL];	/* Seek structure for each device */
  struct	buf	rltab;
  
--- 32,39 ----
  
  struct	rldevice *RLADDR;
  
! static	int	q22bae = 1;
! 
  struct	buf	rlutab[NRL];	/* Seek structure for each device */
  struct	buf	rltab;
  
***************
*** 274,282 ****
  	rladdr->rlda = (rl.chn << 6) | rl.sn;
  	rladdr->rlba = (caddr_t)rl.rl_un.w[1];
  	rladdr->rlmp = -(rl.bpart >> 1);
! #ifdef Q22
! 	rladdr->rlbae = rl.rl_un.w[0];
! #endif
  	rladdr->rlcs = rl.com | (rl.rl_un.w[0] & 03) << 4;
  #ifdef UCB_METER
  	if (rl_dkn >= 0) {
--- 275,284 ----
  	rladdr->rlda = (rl.chn << 6) | rl.sn;
  	rladdr->rlba = (caddr_t)rl.rl_un.w[1];
  	rladdr->rlmp = -(rl.bpart >> 1);
! 	if	(q22bae == 1)
! 		q22bae = (fioword(&rladdr->rlbae) == -1 ? -1 : 0);
! 	if	(q22bae == 0)
! 		rladdr->rlbae = rl.rl_un.w[0];
  	rladdr->rlcs = rl.com | (rl.rl_un.w[0] & 03) << 4;
  #ifdef UCB_METER
  	if (rl_dkn >= 0) {
***************
*** 289,308 ****
  #endif
  }
  
- rlread(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return (physio(rlstrategy, &rrlbuf[minor(dev)], dev, B_READ, WORD, uio));
- }
- 
- rlwrite(dev, uio)
- 	register dev_t dev;
- 	struct uio *uio;
- {
- 	return (physio(rlstrategy, &rrlbuf[minor(dev)], dev, B_WRITE, WORD, uio));
- }
- 
  /*
   * Start a seek on an rl drive
   * Greg Travis, April 1982 - Adapted to 2.8/2.9 BSD Oct 1982/May 1984
--- 291,296 ----
***************
*** 458,466 ****
  		} else {
  #endif
  			rladdr->rlba = loint(paddr);
! #ifdef Q22
! 			rladdr->rlbae = hiint(paddr);
! #endif
  			com |= (hiint(paddr) & 03) << 4;
  #ifdef UNIBUS_MAP
  		}
--- 446,455 ----
  		} else {
  #endif
  			rladdr->rlba = loint(paddr);
! 			if	(q22bae == 1)
! 				q22bae = (fioword(&rladdr->rlbae) == -1 ? -1:0);
! 			if	(q22bae == 0)
! 				rladdr->rlbae = hiint(paddr);
  			com |= (hiint(paddr) & 03) << 4;
  #ifdef UNIBUS_MAP
  		}
*** /old/src/sys/pdpuba/rlreg.h	Mon Jul  6 11:17:07 1987
--- /usr/src/sys/pdpuba/rlreg.h	Wed Apr 24 20:44:13 1991
***************
*** 12,20 ****
  	caddr_t	rlba;
  	short	rlda;
  	short	rlmp;
- #ifdef Q22
  	short	rlbae;
- #endif
  };
  
  /* bits in rlcs */
--- 12,18 ----
*** /old/src/sys/pdpuba/rx.c	Tue Apr  3 11:10:34 1990
--- /usr/src/sys/pdpuba/rx.c	Sun Sep 22 08:41:32 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rx.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)rx.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 53,59 ****
  #define	seccnt(bp)	((int)((bp)->b_seccnt))
  
  struct	buf	rxtab;
- struct	buf	rrxbuf;
  struct	buf	crxbuf;		/* buffer header for control functions */
  
  /*
--- 53,58 ----
***************
*** 297,317 ****
  	*xmem = bp->b_xmem;
  	if (*addr < bp->b_un.b_addr)		/* overflow, bump xmem */
  		(*xmem)++;
- }
- 
- rxread(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return (physio(rxstrategy, &rrxbuf, dev, B_READ, WORD, uio));
- }
- 
- 
- rxwrite(dev, uio)
- 	dev_t dev;
- 	struct uio *uio;
- {
- 	return (physio(rxstrategy, &rrxbuf, dev, B_WRITE, WORD, uio));
  }
  
  /*
--- 296,301 ----
*** /old/src/sys/pdpuba/si.c	Tue Apr  3 09:59:43 1990
--- /usr/src/sys/pdpuba/si.c	Sun Sep 22 08:41:56 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)si.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)si.c	1.2 (2.11BSD Berkeley) 9/22/91
   */
  
  /*
***************
*** 59,65 ****
  int	si_offset[] = { SI_OFP,	SI_OFM };
  
  struct	buf	sitab;
- struct	buf	rsibuf;
  struct	buf	siutab[NSI];
  
  int	sicc[NSI];	/* Current cylinder */
--- 59,64 ----
***************
*** 398,417 ****
  	}
  
  	sistart();
- }
- 
- siread(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return (physio(sistrategy, &rsibuf, dev, B_READ, WORD, uio));
- }
- 
- siwrite(dev, uio)
- 	dev_t	dev;
- 	struct uio *uio;
- {
- 	return (physio(sistrategy, &rsibuf, dev, B_WRITE, WORD, uio));
  }
  
  #ifdef SI_DUMP
--- 397,402 ----
*** /old/src/sys/pdpuba/tm.c	Tue Apr  3 21:47:56 1990
--- /usr/src/sys/pdpuba/tm.c	Sun Sep 22 08:42:33 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tm.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tm.c	2.1 (2.11BSD) 9/22/91
   */
  
  /*
***************
*** 28,39 ****
  
  struct	buf	tmtab;
  struct	buf	ctmbuf;
- /*
-  * Raw tape operations use rtmbuf.  The driver notices when rtmbuf is being
-  * used and allows the user program to continue after errors and read records
-  * not of the standard length (DEV_BSIZE).
-  */
- struct	buf	rtmbuf;
  
  /*
   * Software state per tape transport:
--- 28,33 ----
***************
*** 244,254 ****
  register struct buf *bp;
  {
  	register s;
  
  #ifdef UNIBUS_MAP
- 	if (bp != &ctmbuf)
  		mapalloc(bp);
  #endif
  	bp->av_forw = NULL;
  	s = splbio();
  	if (tmtab.b_actf == NULL)
--- 238,252 ----
  register struct buf *bp;
  {
  	register s;
+ 	register struct te_softc *sc = &te_softc[TEUNIT(bp->b_dev)];
  
+ 	if (bp->b_flags & B_PHYS) {
  #ifdef UNIBUS_MAP
  		mapalloc(bp);
  #endif
+ 		sc->sc_blkno = sc->sc_nxrec = dbtofsb(bp->b_blkno);
+ 		sc->sc_nxrec++;
+ 	}
  	bp->av_forw = NULL;
  	s = splbio();
  	if (tmtab.b_actf == NULL)
***************
*** 325,331 ****
  	/*
  	 * The following checks handle boundary cases for operation
  	 * on non-raw tapes.  On raw tapes the initialization of
! 	 * sc->sc_nxrec by tmphys causes them to be skipped normally
  	 * (except in the case of retries).
  	 */
  	if (dbtofsb(bp->b_blkno) > sc->sc_nxrec) {
--- 323,329 ----
  	/*
  	 * The following checks handle boundary cases for operation
  	 * on non-raw tapes.  On raw tapes the initialization of
! 	 * sc->sc_nxrec on entry causes them to be skipped normally
  	 * (except in the case of retries).
  	 */
  	if (dbtofsb(bp->b_blkno) > sc->sc_nxrec) {
***************
*** 339,345 ****
  	if (dbtofsb(bp->b_blkno) == sc->sc_nxrec && bp->b_flags & B_READ) {
  		/*
  		 * Reading at end of file returns 0 bytes.
! 		 * Buffer will be cleared (if written) in writei.
  		 */
  		bp->b_resid = bp->b_bcount;
  		goto next;
--- 337,343 ----
  	if (dbtofsb(bp->b_blkno) == sc->sc_nxrec && bp->b_flags & B_READ) {
  		/*
  		 * Reading at end of file returns 0 bytes.
! 		 * Buffer will be cleared (if written) in rwip.
  		 */
  		bp->b_resid = bp->b_bcount;
  		goto next;
***************
*** 463,469 ****
  		 * If we were reading raw tape and the only error was that the
  		 * record was too long, then we don't consider this an error.
  		 */
! 		if (bp == &rtmbuf && (bp->b_flags & B_READ) &&
  		    (tmaddr->tmer & (TMER_HARD | TMER_SOFT)) == TMER_RLE)
  			goto ignoreerr;
  		/*
--- 461,467 ----
  		 * If we were reading raw tape and the only error was that the
  		 * record was too long, then we don't consider this an error.
  		 */
! 		if ((bp->b_flags & B_PHYS) && (bp->b_flags & B_READ) &&
  		    (tmaddr->tmer & (TMER_HARD | TMER_SOFT)) == TMER_RLE)
  			goto ignoreerr;
  		/*
***************
*** 480,486 ****
  			 * Hard or non-i/o errors on non-raw tape
  			 * cause it to close.
  			 */
! 			if (sc->sc_openf > 0 && bp != &rtmbuf)
  				sc->sc_openf = -1;
  		/*
  		 * Couldn't recover error
--- 478,484 ----
  			 * Hard or non-i/o errors on non-raw tape
  			 * cause it to close.
  			 */
! 			if (sc->sc_openf > 0 && !(bp->b_flags & B_PHYS))
  				sc->sc_openf = -1;
  		/*
  		 * Couldn't recover error
***************
*** 572,617 ****
  	}
  	/* eof on read */
  	sc->sc_nxrec = bn;
- }
- 
- tmread(dev, uio)
- register dev_t dev;
- register struct uio *uio;
- {
- 	int errno;
- 
- 	errno = tmphys(dev, uio);
- 	if (errno)
- 		return (errno);
- 	return (physio(tmstrategy, &rtmbuf, dev, B_READ, BYTE, uio));
- }
- 
- tmwrite(dev, uio)
- register dev_t dev;
- register struct uio *uio;
- {
- 	int errno;
- 
- 	errno = tmphys(dev, uio);
- 	if (errno)
- 		return (errno);
- 	return (physio(tmstrategy, &rtmbuf, dev, B_WRITE, BYTE, uio));
- }
- 
- /*
-  * Set up sc_blkno and sc_nxrec
-  * so that the tape will appear positioned correctly.
-  */
- tmphys(dev, uio)
- dev_t dev;
- register struct uio *uio;
- {
- 	daddr_t a;
- 	register struct te_softc *sc = &te_softc[TEUNIT(dev)];
- 
- 	a = dbtofsb(uio->uio_offset >> 9);
- 	sc->sc_blkno = a;
- 	sc->sc_nxrec = a + 1;
  }
  
  /*ARGSUSED*/
--- 570,575 ----
