[comp.bugs.2bsd] /boot,/mdec,[T]MSCP

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 1 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 1 of 22

The GENERIC kernel required an adjustment of the overlay structure.

*** /usr/src/sys/GENERIC/Makefile.old	Sat Apr  6 00:30:59 1991
--- /usr/src/sys/GENERIC/Makefile	Sat Apr  6 00:29:02 1991
***************
*** 58,66 ****
  	kern_xxx.o quota_sys.o subr_prf.o sys_process.o \
  	syscalls.o ufs_mount.o subr_log.o vm_swp.o
  OV4=	tty_pty.o quota_kern.o quota_subr.o quota_ufs.o machdep2.o \
! 	cons.o ra.o kern_prot.o machdep.o
  OV5=	ht.o tm.o ts.o
! OV6=	tmscp.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \
--- 58,66 ----
  	kern_xxx.o quota_sys.o subr_prf.o sys_process.o \
  	syscalls.o ufs_mount.o subr_log.o vm_swp.o
  OV4=	tty_pty.o quota_kern.o quota_subr.o quota_ufs.o machdep2.o \
! 	ra.o kern_prot.o machdep.o
  OV5=	ht.o tm.o ts.o
! OV6=	tmscp.o cons.o
  
  KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \
  	${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 2 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 2 of 22

All of the files in /sys/conf/boot were modified to pass the CSR and
unit number (along with the Major device number) to the bootblock read
from the device.  The bootblocks all expect the unit number to be in
R0 and the CSR in R1.

'reset' is recognized by the 2.11BSD assembler now so the definition of
it was removed.

*** /usr/src/sys/conf/boot.old/brboot.s	Fri Aug 26 14:31:45 1988
--- /usr/src/sys/conf/boot/brboot.s	Tue Apr 23 11:26:38 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)brboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)brboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 52,66 ****
  
  / BR bootstrap
  
! brda =	176724
  
! 	mov	$brda,r0
! 	clr	(r0)		/ disk address
! 	clr	-(r0)		/ cylinder address
! 	clr	-(r0)		/ bus address
! 	mov	$-256.,-(r0)	/ wc
! 	mov	$5,-(r0)	/ cs: read+go
! 1:	tstb	(r0)		/ wait for ready
  	bge	1b
  
! 	jmp	*$0		/ transfer to zero
--- 52,72 ----
  
  / BR bootstrap
  
! brda =	10
  
! 	mov	_bootcsr, r1	/ csr of boot device
! 	add	$brda,r1
! 	clr	(r1)		/ disk address
! 	clr	-(r1)		/ cylinder address
! 	clr	-(r1)		/ bus address
! 	mov	$-256.,-(r1)	/ wc
! 	mov	ENDCORE-BOOTDEV,r0
! 	swab	r0		/ unit number to high byte
! 	bis	$5,r0		/ read+go
! 	mov	r0,-(r1)	/ cs: read+go
! 1:	tstb	(r1)		/ wait for ready
  	bge	1b
  
! 	mov	_bootcsr,r1	/ put csr and
! 	mov	ENDCORE-BOOTDEV,r0	/  unit where bootblock expects them
! 	clr	pc		/ transfer to zero
*** /usr/src/sys/conf/boot.old/dvhpboot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/dvhpboot.s	Fri Apr 19 21:03:06 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)dvhpboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)dvhpboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 53,83 ****
  /
  / Bootstrap for DIVA Comp/V controller without boot opcode
  /
! HPCSR=	176700		/ Drive #0
! HPDC=	176734		/ Desired cylinder
! HPBAE=	176750		/ Bus extension address (RH70)
! HPCS2=	176710		/ Control/status register 2
  READIT=	71
- CSW=	177570		/ Console switch display register
  
  1:
! 	bitb	$200,*$HPCSR	/ wait for ready
! 	beq	1b
  
! 	mov	$0710,*$CSW	/ For debugging
! 	mov	$0,*$HPDC	/ Cylinder 0
! 	mov	$0,*$HPBAE	/ Bus extension address = 0
! 	mov	$HPCS2,r0
! 	mov	$0,-(r0)	/ HPCSR->hpda = 0 (desired address 0)
! 	mov	$0,-(r0)	/ HPCSR->hpba = 0 (buf address 0)
! 	mov	$177400,-(r0)	/ HPCSR->hpwc = -256 (one block)
! 	mov	$READIT,-(r0)	/ HPCSR->hpcs1 = HP_RCOM|HP_GO
! 	mov	$0711,*$CSW	/ For debugging
  
  1:
! 	bitb	$200,*$HPCSR	/ wait for done
! 	beq	1b
! 	mov	$0712,*$CSW	/ For debugging
! 	jmp	*$0
! 
! / no return
--- 53,80 ----
  /
  / Bootstrap for DIVA Comp/V controller without boot opcode
  /
! HPCSR=	0		/ offset from base csr
! HPCS2=	10		/ Control/status register 2
! HPDC=	34		/ Desired cylinder
! HPBAE=	50		/ Bus extension address (RH70)
  READIT=	71
  
+ 	mov	_bootcsr,r1	/ boot device csr
  1:
! 	tstb	(r1)		/ wait for ready (HPCSR is offset 0)
! 	bpl	1b
  
! 	clr	HPDC(r1)	/ Cylinder 0
! 	clr	HPBAE		/ Bus extension address = 0
! 	add	$HPCS2,r1
! 	mov	ENDCORE-BOOTDEV,(r1)	/ unit number
! 	clr	-(r1)		/ hpda = 0 (desired address 0)
! 	clr	-(r1)		/ hpba = 0 (buf address 0)
! 	mov	$-256.,-(r1)	/ hpwc = -256 (one block)
! 	mov	$READIT,-(r1)	/ hpcs1 = HP_RCOM|HP_GO
  
  1:
! 	tstb	(r1)		/ wait for done
! 	bpl	1b
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/hk6boot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/hk6boot.s	Fri Apr 19 21:03:14 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)hk6boot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)hk6boot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 54,63 ****
  
  WC = -256.
  
! hkcs1 = 177440	/ control & status 1
! hkda  = 177446	/ desired track/sector address
! hkcs2 = 177450	/ control & status 2
! hkca  = 177460	/ desired cylinder
  
  / RK06 constants.
  ack = 03	/ pack acknowledge
--- 54,63 ----
  
  WC = -256.
  
! hkcs1 = 0	/ offsets from base csr, control & status 1
! hkda  = 6	/ desired track/sector address
! hkcs2 = 10	/ control & status 2
! hkca  = 20	/ desired cylinder
  
  / RK06 constants.
  ack = 03	/ pack acknowledge
***************
*** 65,79 ****
  iocom = 021	/ read + go
  
  / initialize hk
! 	mov	$clear,hkcs2
! 	mov	$ack,hkcs1
  0:
! 	tstb	hkcs1
  	bpl	0b		/ wait for acknowledge to complete
  
! 	clr	hkca
! 	mov	$hkda,r1
! 	clr	(r1)		/ sector and track
  	clr	-(r1)		/ bus address
  	mov	$WC,-(r1)	/ word count
  	mov	$iocom,-(r1)
--- 65,81 ----
  iocom = 021	/ read + go
  
  / initialize hk
! 	mov	_bootcsr,r1
! 	mov	$clear,hkcs2(r1)
! 	mov	$ack,hkcs1(r1)
  0:
! 	tstb	hkcs1(r1)
  	bpl	0b		/ wait for acknowledge to complete
  
! 	clr	hkca(r1)
! 	add	$hkcs2,r1
! 	mov	ENDCORE-BOOTDEV,(r1)
! 	clr	-(r1)		/ sector and track (hkda)
  	clr	-(r1)		/ bus address
  	mov	$WC,-(r1)	/ word count
  	mov	$iocom,-(r1)
***************
*** 80,83 ****
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
! 	jmp	*$0
--- 82,86 ----
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/hk7boot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/hk7boot.s	Fri Apr 19 21:03:21 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)hk7boot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)hk7boot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 54,63 ****
  
  WC = -256.
  
! hkcs1 = 177440	/ control & status 1
! hkda  = 177446	/ desired track/sector address
! hkcs2 = 177450	/ control & status 2
! hkca  = 177460	/ desired cylinder
  
  / RK07 constants
  ack = 02003	/ pack acknowledge
--- 54,63 ----
  
  WC = -256.
  
! hkcs1 = 0	/ offsets from base csr, control & status 1
! hkda  = 6	/ desired track/sector address
! hkcs2 = 10	/ control & status 2
! hkca  = 20	/ desired cylinder
  
  / RK07 constants
  ack = 02003	/ pack acknowledge
***************
*** 65,79 ****
  iocom = 2021	/ read + go
  
  / initialize hk
! 	mov	$clear,hkcs2
! 	mov	$ack,hkcs1
  0:
! 	tstb	hkcs1
  	bpl	0b		/ wait for acknowledge to complete
  
! 	clr	hkca
! 	mov	$hkda,r1
! 	clr	(r1)		/ sector and track
  	clr	-(r1)		/ bus address
  	mov	$WC,-(r1)	/ word count
  	mov	$iocom,-(r1)
--- 65,81 ----
  iocom = 2021	/ read + go
  
  / initialize hk
! 	mov	_bootcsr,r1
! 	mov	$clear,hkcs2(r1)
! 	mov	$ack,hkcs1(r1)
  0:
! 	tstb	hkcs1(r1)
  	bpl	0b		/ wait for acknowledge to complete
  
! 	clr	hkca(r1)
! 	add	$hkcs2,r1
! 	mov	ENDCORE-BOOTDEV,(r1)
! 	clr	-(r1)		/ sector and track (hkda)
  	clr	-(r1)		/ bus address
  	mov	$WC,-(r1)	/ word count
  	mov	$iocom,-(r1)
***************
*** 80,83 ****
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
! 	jmp	*$0
--- 82,86 ----
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/raboot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/raboot.s	Fri Apr 19 21:03:29 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)raboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)raboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 89,102 ****
  RALBNL =	112.	/ Logical block number low
  RALBNH = 	114.	/ Logical block number high
  
- raip	= 172150	/ initialization and polling register
- rasa	= 172152	/ address and status register
- 
  BSIZE	=	512.	/ Size of boot block
- /
- / options:
- /
- unit	= 0		/ # of unit to load boot from
  
  /
  / Clear RA MSCP command area!
--- 89,95 ----
***************
*** 112,118 ****
  / RA initialize controller 
  /
  	mov	$RASTEP1,r0
! 	mov	$raip,r1
  	clr	(r1)+			/ go through controller init seq.
  	mov	$icons,r2
  1:
--- 105,111 ----
  / RA initialize controller 
  /
  	mov	$RASTEP1,r0
! 	mov	_bootcsr,r1		/ get csr of boot controller
  	clr	(r1)+			/ go through controller init seq.
  	mov	$icons,r2
  1:
***************
*** 125,131 ****
  	mov	$ra+RACMDREF,*$ra+RACMDL
  	mov	$RASTCON,r0
  	jsr	pc,racmd
! 	mov	$unit,*$ra+RAUNIT	/ bring boot unit online
  	mov	$RAONLIN,r0
  	jsr	pc,racmd
  
--- 118,124 ----
  	mov	$ra+RACMDREF,*$ra+RACMDL
  	mov	$RASTCON,r0
  	jsr	pc,racmd
! 	mov	ENDCORE-BOOTDEV,*$ra+RAUNIT	/ bring boot unit online
  	mov	$RAONLIN,r0
  	jsr	pc,racmd
  
***************
*** 142,166 ****
  / 
  / Tim Tucker, Gould Electronics, August 23rd 1985
  /
! 	clr	r0
! 	mov	r0,*$ra+RALBNL		/ Put in logical block number
  	mov	$BSIZE,*$ra+RABYTECT	/ Put in byte to transfer
! 	mov	r0,*$ra+RABUFL		/ Put in disk buffer location
  	mov	$RAREAD,r0
  	jsr	pc,racmd
! 	jmp	*$0			/ and away we go
  /
  / perform MSCP command -> response poll version
  /
  racmd:
  	movb	r0,*$ra+RAOPCODE	/ fill in command type
! 	mov	$MSCPSIZE,r0
! 	mov	r0,*$ra+RARSPS		/ give controller struct sizes
! 	mov	r0,*$ra+RACMDS
! 	mov	$RASEMAP,r0
! 	mov	r0,*$ra+RARSPH		/ set mscp semaphores
! 	mov	r0,*$ra+RACMDH
! 	mov	raip,r0			/ tap controllers shoulder
  	mov	$ra+RACMDI,r0
  1:
  	tst	(r0)
--- 135,158 ----
  / 
  / Tim Tucker, Gould Electronics, August 23rd 1985
  /
! 	clr	*$ra+RALBNL		/ Put in logical block number
  	mov	$BSIZE,*$ra+RABYTECT	/ Put in byte to transfer
! 	clr	*$ra+RABUFL		/ Put in disk buffer location
  	mov	$RAREAD,r0
  	jsr	pc,racmd
! 	mov	ENDCORE-BOOTDEV,r0	/ put unit and
! 	mov	_bootcsr,r1		/   csr where bootblock expects them
! 	clr	pc			/ and away we go
  /
  / perform MSCP command -> response poll version
  /
  racmd:
  	movb	r0,*$ra+RAOPCODE	/ fill in command type
! 	mov	$MSCPSIZE,*$ra+RARSPS	/ give controller struct sizes
! 	mov	$MSCPSIZE,*$ra+RACMDS
! 	mov	$RASEMAP,*$ra+RARSPH	/ set mscp semaphores
! 	mov	$RASEMAP,*$ra+RACMDH
! 	mov	*_bootcsr,r0		/ tap controllers shoulder
  	mov	$ra+RACMDI,r0
  1:
  	tst	(r0)
*** /usr/src/sys/conf/boot.old/rlboot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/rlboot.s	Fri Apr 19 21:03:34 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)rlboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)rlboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 57,87 ****
  SEEK	= 3\<1
  RDHDR	= 4\<1
  
! rlcs	= 174400
! rlda	= 174404
! rlba	= 174402
! rlmp	= 174406
  
! 	mov	$RDHDR,*$rlcs	/find out where we are (cyl)
  1:
! 	tstb	*$rlcs
  	bpl	1b
! 	mov	*$rlmp,r0
  	bic	$!77600,r0
  	bis	$1,r0
! 	mov	r0,*$rlda
! 	mov	$SEEK,*$rlcs	/ move it
  1:
! 	tstb	*$rlcs
  	bpl	1b
  /
! 	mov	$rlmp,r0
! 	mov	$WC,(r0)	/wc into rlmp
! 	clr	-(r0)		/da into rlda
! 	clr	-(r0)		/ba
! 	mov	$READ,-(r0)	/cmd into rlcs
  1:
! 	tstb	*$rlcs
  	bpl	1b
  /
! 	jmp	*$0		/ and away we go
--- 57,95 ----
  SEEK	= 3\<1
  RDHDR	= 4\<1
  
! rlcs	= 0
! rlba	= 2
! rlda	= 4
! rlmp	= 6
  
! 	mov	_bootcsr,r1
! 	mov	ENDCORE-BOOTDEV,r2
! 	bis	$RDHDR,r2
! 	mov	r2,rlcs(r1)	/find out where we are (cyl)
  1:
! 	tstb	rlcs(r1)
  	bpl	1b
! 	mov	rlmp(r1),r0
  	bic	$!77600,r0
  	bis	$1,r0
! 	mov	r0,rlda(r1)
! 	mov	ENDCORE-BOOTDEV,r2
! 	bis	$SEEK,r2
! 	mov	r2,rlcs(r1)	/ move it
  1:
! 	tstb	rlcs(r1)
  	bpl	1b
  /
! 	add	$rlmp,r1
! 	mov	$WC,(r1)	/wc into rlmp
! 	clr	-(r1)		/da into rlda
! 	clr	-(r1)		/ba
! 	mov	ENDCORE-BOOTDEV,r2
! 	bis	$READ,r2
! 	mov	r2,-(r0)	/cmd into rlcs
  1:
! 	tstb	rlcs(r1)
  	bpl	1b
  /
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc		/ and away we go
*** /usr/src/sys/conf/boot.old/rmboot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/rmboot.s	Fri Apr 19 21:03:43 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)rmboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)rmboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 59,65 ****
  FMT22	= 10000
  DRIVE	= 0
  
! rmcs1	= 176700
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
--- 59,65 ----
  FMT22	= 10000
  DRIVE	= 0
  
! rmcs1	= 0
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
***************
*** 66,81 ****
  rmof	= rmcs1+32
  rmca	= rmcs1+34
  
! 	mov	$DRIVE,*$rmcs2
! 	mov	$PRESET+GO,*$rmcs1
! 	mov	$FMT22,*$rmof
! 	clr	*$rmca
! 	mov	$rmda,r0
! 	clr	(r0)
! 	clr	-(r0)
! 	mov	$WC,-(r0)
! 	mov	$READ+GO,-(r0)
  1:
! 	tstb	(r0)
  	bge	1b
! 	jmp	*$0
--- 66,84 ----
  rmof	= rmcs1+32
  rmca	= rmcs1+34
  
! 	mov	_bootcsr,r1
! 	mov	ENDCORE-BOOTDEV,rmcs2(r1)
! 	mov	$PRESET+GO,rmcs1(r1)
! 	mov	$FMT22,rmof(r1)
! 	clr	rmca(r1)
! 	add	$rmcs2,r1
! 	mov	ENDCORE-BOOTDEV,(r1)
! 	clr	-(r1)
! 	clr	-(r1)
! 	mov	$WC,-(r1)
! 	mov	$READ+GO,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/sc11boot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/sc11boot.s	Fri Apr 19 21:03:49 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)sc11boot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)sc11boot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 51,67 ****
  /  if necessary, read in block 0 to location 0 "by hand".
  
  /  Bootstrap for Emulex SC11/B with boot opcode
! unit =	0		/  unit to boot from
! RMCS1=	176700
! RMCS2=	176710
  BOOT=	75
! 	mov	$RMCS1,r0
! 	mov	$unit, RMCS2
! 	mov	$BOOT,(r0)
! 2:	tstb	(r0)
  	bpl	2b		/ wait for done (RDY)
! 	tst	(r0)
  	bmi	1b		/ try again on error (TRE)
! 
! 	jmp	*$0
! / no return
--- 51,65 ----
  /  if necessary, read in block 0 to location 0 "by hand".
  
  /  Bootstrap for Emulex SC11/B with boot opcode
! RMCS1=	0
! RMCS2=	10
  BOOT=	75
! 	mov	_bootcsr,r1
! 	mov	ENDCORE-BOOTDEV, RMCS2(r1)
! 	mov	$BOOT,(r1)
! 2:	tstb	(r1)
  	bpl	2b		/ wait for done (RDY)
! 	tst	(r1)
  	bmi	1b		/ try again on error (TRE)
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/sc21boot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/sc21boot.s	Fri Apr 19 21:03:55 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)sc21boot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)sc21boot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 52,70 ****
  
  /  Bootstrap for Emulex SC21 with boot opcode
  
! unit =	0		/  unit to boot from
! RMCS1=	176700
! RMCS2=	176710
! RMHR=	176736
  BOOT=	75
! 	mov	$RMCS1,r0
! 	mov	$unit, RMCS2
! 	mov	$-1, RMHR	/ enable extended opcodes
! 	mov	$BOOT,(r0)
! 2:	tstb	(r0)
  	bpl	2b		/ wait for done (RDY)
! 	tst	(r0)
  	bmi	1b		/ try again on error (TRE)
! 
! 	jmp	*$0
! / no return
--- 52,68 ----
  
  /  Bootstrap for Emulex SC21 with boot opcode
  
! RMCS1=	0
! RMCS2=	10
! RMHR=	36
  BOOT=	75
! 	mov	_bootcsr,r1
! 	mov	ENDCORE-BOOTDEV, RMCS2(r1)
! 	mov	$-1, RMHR(r1)	/ enable extended opcodes
! 	mov	$BOOT,(r1)
! 2:	tstb	(r1)
  	bpl	2b		/ wait for done (RDY)
! 	tst	(r1)
  	bmi	1b		/ try again on error (TRE)
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc
*** /usr/src/sys/conf/boot.old/siboot.s	Thu Feb 19 22:24:03 1987
--- /usr/src/sys/conf/boot/siboot.s	Fri Apr 19 21:04:01 1991
***************
*** 1,5 ****
  /*
!  *	SCCS id	@(#)siboot.s	1.2 (Berkeley)	2/19/87
   */
  #include "localopts.h"
  
--- 1,5 ----
  /*
!  *	SCCS id	@(#)siboot.s	2.0 (2.11BSD)	4/13/91
   */
  #include "localopts.h"
  
***************
*** 8,19 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
  CHECKWORD=	6
  
! reset= 	5
! 
! .globl	_doboot, hardboot
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
--- 8,17 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ boot unit
  CHECKWORD=	6
  
! .globl	_doboot, hardboot, _bootcsr
  .text
  _doboot:
  	mov	4(sp),r4	/ boot options
***************
*** 35,44 ****
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4, r3.
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
--- 33,44 ----
  #endif
  
  /  On power fail, hardboot is the entry point (map is already off)
! /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  
  hardboot:
  	mov	r4, ENDCORE-BOOTOPTS
+ 	ash	$-3,r3		/ shift out the partition number
+ 	bic	$!7,r3		/ save only the drive number
  	mov	r3, ENDCORE-BOOTDEV
  	com	r4		/ if CHECKWORD == ~bootopts, flags are believed
  	mov	r4, ENDCORE-CHECKWORD
***************
*** 56,62 ****
  READ	= 4
  GO	= 1
  
! sicnr	= 176700
  siwcr	= sicnr+2
  sipcr	= sicnr+4
  sihsr	= sicnr+6
--- 56,62 ----
  READ	= 4
  GO	= 1
  
! sicnr	= 0
  siwcr	= sicnr+2
  sipcr	= sicnr+4
  sihsr	= sicnr+6
***************
*** 64,90 ****
  sierr	= sicnr+12
  siscr	= sicnr+24
  
! 	mov	*$siscr,r0	/ load dual port register
! 	bit	$200,r0		/ see if grant set
  	bne	1f		/ if set, is dual ported controller
! 	mov	*$sierr,r0	/ load error register
  	bic	$037777,r0	/ clear all but contention and error bits
  	cmp	$140000,r0	/ see if we have a contention error
  	bne	2f		/ if not, controller is not dual ported
  1:
! 	bit	$200,*$siscr	/ test for grant
  	bne	2f		/ if set, ok for read
! 	clr	*$sicnr		/ send logic master clear
! 	mov	$1,*$siscr	/ request grant
  	br	1b		/ loop until grant
  2:
! 	clr	r0		/ clear r0
! 	mov	r0,*$sipcr	/ port 0 cylinder 0
! 	mov	r0,*$sihsr	/ head 0 sector 0
! 	mov	r0,*$simar	/ address 0
! 	mov	$WC,*$siwcr	/ word count
! 	mov	$READ+GO,*$sicnr
  1:
! 	tstb	*$sicnr
  	bge	1b
! 	jmp	*$0
--- 64,92 ----
  sierr	= sicnr+12
  siscr	= sicnr+24
  
! 	mov	_bootcsr,r1
! 	bit	$200,siscr(r1)	/ see if grant set
  	bne	1f		/ if set, is dual ported controller
! 	mov	sierr(r1),r0	/ load error register
  	bic	$037777,r0	/ clear all but contention and error bits
  	cmp	$140000,r0	/ see if we have a contention error
  	bne	2f		/ if not, controller is not dual ported
  1:
! 	bit	$200,siscr(r1)	/ test for grant
  	bne	2f		/ if set, ok for read
! 	clr	sicnr(r1)	/ send logic master clear
! 	mov	$1,siscr(r1)	/ request grant
  	br	1b		/ loop until grant
  2:
! 	mov	ENDCORE-BOOTDEV,r0
! 	ash	$10.,r0
! 	mov	r0,sipcr(r1)	/ port 0 cylinder 0, unit
! 	clr	sihsr(r1)	/ head 0 sector 0
! 	clr	simar(r1)	/ address 0
! 	mov	$WC,siwcr(r1)	/ word count
! 	mov	$READ+GO,sicnr(r1)
  1:
! 	tstb	sicnr(r1)
  	bge	1b
! 	mov	ENDCORE-BOOTDEV,r0
! 	clr	pc

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 3 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 3 of 22

The 'ubmap' variable has to be a "int" instead of "char" for the
'mfkd' routine used by the network to access 'ubmap' in the kernel's
address space.

*** /usr/src/sys/h/uba.h.old	Fri Apr 29 21:33:44 1988
--- /usr/src/sys/h/uba.h	Sat Apr  6 00:06:21 1991
***************
*** 70,76 ****
  				}
  
  #ifdef KERNEL
! extern	bool_t	ubmap;			/* Do we have UNIBUS registers? */
  extern	memaddr	bpaddr;			/* physical click-address of buffers */
  #ifdef UNIBUS_MAP
  extern	struct map	ub_map[];
--- 70,76 ----
  				}
  
  #ifdef KERNEL
! extern	short	ubmap;			/* Do we have UNIBUS registers? */
  extern	memaddr	bpaddr;			/* physical click-address of buffers */
  #ifdef UNIBUS_MAP
  extern	struct map	ub_map[];

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 4 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 4 of 22

ALL of the bootblocks in /sys/mdec were modified to use the unit and
controller CSR passed in R0 and R1 by the boot roms.  Also, all of
the bootblocks had the "nop; br ." sequence added at the beginning, this
is required by some of the DEC boot roms.

The bootstraps also incorporate the major device number in them now and
pass this information thru to 'boot' and the other standalone utilities.

*** /usr/src/sys/mdec.old/bruboot.s	Tue Jun  5 10:21:38 1990
--- /usr/src/sys/mdec/bruboot.s	Wed Apr 24 10:08:03 1991
***************
*** 1,9 ****
  / BR bootstrap. supports the 32 sec/trk, 19 trk/cyl EATON 1537/1711 
! /	Controller and 1538D drive. 
! /	NOTE: there isn't enough room at present to autoadapt
! / 	      to the 22 sectored & 5 cylinder 1538A,B,C drive types. The
! /	      appropriate "div" instructions have to be modified to support
! /	      these drive types.
  /
  / disk boot program to load and transfer
  / to a unix entry.
--- 1,7 ----
+ MAJOR = 11.			/ major # from bdevsw[]
+ 
  / BR bootstrap. supports the 32 sec/trk, 19 trk/cyl EATON 1537/1711 
! /	Controller and 1538A/B/C/D drive. 
  /
  / disk boot program to load and transfer
  / to a unix entry.
***************
*** 12,19 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- cyl	= 0.		/ cylinder offset of filesys to read from
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 10,15 ----
***************
*** 45,51 ****
--- 41,52 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	movb	r0,unit+1	/ save the unit in high byte (for brcs)
+ 	mov	r1,csr		/  and csr from the ROMs (not base addr!)
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 57,65 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 58,65 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 66,72 ****
  	blo	2b
  
  / initialize controller
! 	clr	*$brcs			/ clr addr extension bits, sel drive 0
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 66,86 ----
  	blo	2b
  
  / initialize controller
! 	mov	csr,r1
! 	mov	unit,brcs(r1)		/ clr addr extension bits, select unit
! 	mov	$32.,r0			/ default # of sec/track
! 	bit	$2400,brae(r1)		/ is this a 22 sec/track drive
! 	beq	9f
! 	mov	$22.,r0
! 9:
! 	mov	$19.,r5			/ default # of tracks/cyl
! 	bit	$1400,brae(r1)		/ is this a 5 tr/cy drive?
! 	beq	9f			/ no - br
! 	mov	$5,r5
! 9:
! 	mov	r0,sectors
! 	mul	r0,r5			/ sectors/cyl
! 	mov	r5,seccyl
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 154,163 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
! 	br	restart
  
  / read a mapped block
  / offset in file is in bno.
--- 168,179 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	movb	unit+1,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
! 	jmp	restart
  
  / read a mapped block
  / offset in file is in bno.
***************
*** 199,208 ****
  read	= 4
  go	= 1
  
! brcs	= 176714
! brda	= 176724
! brca	= 176722
! brba	= 176720
  / br disk driver.
  / low order address in dno,
  / high order in r0.
--- 215,228 ----
  read	= 4
  go	= 1
  
! brds	= -4
! brer	= -2
! brcs	= 0		/ offset from base csr passed by ROMs
! brwc	= 2
! brba	= 4
! brca	= 6
! brda	= 10
! brae	= 12
  / br disk driver.
  / low order address in dno,
  / high order in r0.
***************
*** 212,233 ****
  .if	CLSIZE-1
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
! 	div	$32.*19.,r0		/ was 20.*10.
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$brca
  	clr	r0
! 	div	$32.,r0			/ was 10.
  	swab	r0
  	bis	r1,r0
! 	mov	r0,*$brda
! 	mov	$brba,r1
! 	mov	$buf,(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 232,252 ----
  .if	CLSIZE-1
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
! 	div	seccyl,r0
! 	mov	csr,r3
! 	mov	r0,brca(r3)
  	clr	r0
! 	div	sectors,r0
  	swab	r0
  	bis	r1,r0
! 	mov	r0,brda(r3)
! 	mov	$buf,brba(r3)
! 	mov	$WC,brwc(r3)
! 	mov	unit,r0
! 	bis	$read+go,r0
! 	mov	r0,(r3)		/ brcs
  1:
! 	tstb	(r3)		/ brcs
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 234,239 ****
--- 253,262 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4		/ strlen(bootnm)
+ unit: 0
+ csr: 0
+ seccyl: 0
+ sectors: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/dvhpuboot.s	Wed May 23 13:00:05 1990
--- /usr/src/sys/mdec/dvhpuboot.s	Wed Apr 24 10:08:07 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 10.			/ major # from bdevsw[]
+ 
  / Bootstrap for Diva Comp. IV controller (33 sectors)
  /
  / disk boot program to load and transfer
***************
*** 7,15 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 9,14 ----
***************
*** 41,47 ****
--- 40,51 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 62,70 ****
  	blo	2b
  
  / initialize disk
! 	mov	$drive,*$hpcs2
! 	mov	$preset+go,*$hpcs1
! 	mov	$fmt22,*$hpof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 66,75 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	unit,hpcs2(r1)
! 	mov	$preset+go,hpcs1(r1)
! 	mov	$fmt22,hpof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 152,159 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 157,166 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 199,205 ****
  go	= 1
  fmt22	= 10000
  
! hpcs1	= 176700
  hpda	= hpcs1+6
  hpcs2	= hpcs1+10
  hpds	= hpcs1+12
--- 206,212 ----
  go	= 1
  fmt22	= 10000
  
! hpcs1	= 0		/ offset from base csr
  hpda	= hpcs1+6
  hpcs2	= hpcs1+10
  hpds	= hpcs1+12
***************
*** 216,236 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$33.*19.,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$hpca
  	clr	r0
  	div	$33.,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$hpda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 223,242 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$33.*19.,r0
! 	mov	csr,r3
! 	mov	r0,hpca(r3)
  	clr	r0
  	div	$33.,r0
  	swab	r0
  	bis	r1,r0
! 	add	$hpcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 237,242 ****
--- 243,250 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/hkuboot.s	Wed May 23 13:00:13 1990
--- /usr/src/sys/mdec/hkuboot.s	Wed Apr 24 10:08:11 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 4			/ major # from bdevsw[]
+ 
  / RK06/RK07 bootstrap
  /
  / disk boot program to load and transfer
***************
*** 40,46 ****
--- 42,53 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 52,60 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 59,66 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 61,70 ****
  	blo	2b
  
  / initialize hk
! 	mov	$clear,*$hkcs2
! 	mov	$ack,*$hkcs1
  0:
! 	tstb	*$hkcs1
  	bpl	0b		/ wait for acknowledge to complete
  
  	mov	$bootnm, r1
--- 67,79 ----
  	blo	2b
  
  / initialize hk
! 	mov	csr,r1
! 	mov	unit,r0
! 	bis	$clear,r0
! 	mov	r0,hkcs2(r1)
! 	mov	$ack,hkcs1(r1)
  0:
! 	tstb	hkcs1(r1)
  	bpl	0b		/ wait for acknowledge to complete
  
  	mov	$bootnm, r1
***************
*** 153,160 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 162,171 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 195,204 ****
  1:
  	rts	pc
  
! hkcs1 = 177440	/ control & status 1
! hkda  = 177446	/ desired track/sector address
! hkcs2 = 177450	/ control & status 2
! hkca  = 177460	/ desired cylinder
  
  .if	RK07
  / RK07 constants
--- 206,215 ----
  1:
  	rts	pc
  
! hkcs1 = 0	/ control & status 1
! hkda  = 6	/ desired track/sector address
! hkcs2 = 10	/ control & status 2
! hkca  = 20	/ desired cylinder
  
  .if	RK07
  / RK07 constants
***************
*** 229,240 ****
  	clr	r0
  	div	$3.,r0		/ r0 = cylinder r1 = track
  	bisb	r1,1(sp)
! 	mov	r0,*$hkca	/ cylinder wanted
! 	mov	$hkda,r1
! 	mov	(sp)+,(r1)	/ track & sector wanted
! 	mov	$buf,-(r1)	/ bus address
! 	mov	$WC,-(r1)	/ word count
! 	mov	$iocom,-(r1)
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
--- 240,253 ----
  	clr	r0
  	div	$3.,r0		/ r0 = cylinder r1 = track
  	bisb	r1,1(sp)
! 	mov	csr,r3
! 	mov	r0,hkca(r3)	/ cylinder wanted
! 	mov	unit,hkcs2(r3)
! 	add	$hkda,r3
! 	mov	(sp)+,(r3)	/ track & sector wanted
! 	mov	$buf,-(r3)	/ bus address
! 	mov	$WC,-(r3)	/ word count
! 	mov	$iocom,-(r3)
  1:
  	tstb	(r1)
  	bge	1b		/ wait for iocom to complete
***************
*** 243,248 ****
--- 256,263 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/hpuboot.s	Wed May 23 13:00:20 1990
--- /usr/src/sys/mdec/hpuboot.s	Wed Apr 24 10:08:15 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 10.			/ major # from bdevsw[]
+ 
  / RP04/05/06 bootstrap.
  /
  / disk boot program to load and transfer
***************
*** 7,15 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 9,14 ----
***************
*** 41,47 ****
--- 40,51 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 53,61 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 57,64 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 62,70 ****
  	blo	2b
  
  / initialize hp
! 	mov	$drive,*$hpcs2
! 	mov	$preset+go,*$hpcs1
! 	mov	$fmt22,*$hpof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 65,74 ----
  	blo	2b
  
  / initialize hp
! 	mov	csr,r1
! 	mov	unit,hpcs2(r1)
! 	mov	$preset+go,hpcs1(r1)
! 	mov	$fmt22,hpof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 152,159 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 156,165 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 199,205 ****
  go	= 1
  fmt22	= 10000
  
! hpcs1	= 176700
  hpda	= hpcs1+6
  hpcs2	= hpcs1+10
  hpds	= hpcs1+12
--- 205,211 ----
  go	= 1
  fmt22	= 10000
  
! hpcs1	= 0
  hpda	= hpcs1+6
  hpcs2	= hpcs1+10
  hpds	= hpcs1+12
***************
*** 216,236 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$22.*19.,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$hpca
  	clr	r0
  	div	$22.,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$hpda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 222,241 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$22.*19.,r0
! 	mov	csr,r3
! 	mov	r0,hpca(r3)
  	clr	r0
  	div	$22.,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$hpcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 237,242 ****
--- 242,249 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/rauboot.s	Wed May 23 13:00:28 1990
--- /usr/src/sys/mdec/rauboot.s	Wed Apr 24 10:08:18 1991
***************
*** 1,15 ****
  / RA bootstrap.
  /
  / disk boot program to load and transfer to a unix entry.
  / for use with 1 KB byte blocks, CLSIZE is 2.
  / NDIRIN is the number of direct inode addresses (currently 4)
- / assembled size must be <= 512; if > 494, the 16-byte a.out header
- / must be removed
  /
  / Note: this is a complex boot, but then MSCP is complex!!!!
  /
  / a.out header must be removed from boot block!
- /
  
  MSCPSIZE =	64.	/ One MSCP command packet is 64bytes long (need 2)
  
--- 1,15 ----
+ MAJOR = 5			/ major # from bdevsw[]
+ 
  / RA bootstrap.
  /
  / disk boot program to load and transfer to a unix entry.
  / for use with 1 KB byte blocks, CLSIZE is 2.
  / NDIRIN is the number of direct inode addresses (currently 4)
  /
  / Note: this is a complex boot, but then MSCP is complex!!!!
  /
+ / assembled size must be <= 512
  / a.out header must be removed from boot block!
  
  MSCPSIZE =	64.	/ One MSCP command packet is 64bytes long (need 2)
  
***************
*** 43,62 ****
  RALBNL =	112.	/ Logical block number low
  RALBNH = 	114.	/ Logical block number high
  
- raip	= 172150	/ initialization and polling register
- rasa	= 172152	/ address and status register
- 
- cyl	= 0.		/ cylinder offset of filesys to read from
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
  /		  also, this is the single largest boot around to begin with.
  
- mxvboot	= 1		/ 0->normal, 1->adds check done by MXV11 boot ROMS
- 
- unit	= 0		/ # of unit to load boot from
- /
  / constants:
  /
  CLSIZE	= 2.			/ physical disk blocks per logical block
--- 43,53 ----
***************
*** 85,95 ****
  
  / establish sp, copy
  / program up to end of core.
! .if 	mxvboot
! 	0240			/ These two lines must be present or DEC
  	br	start		/ boot ROMs will refuse to run boot block!
- .endif
  start:
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
--- 76,87 ----
  
  / establish sp, copy
  / program up to end of core.
! 
! 	nop			/ These two lines must be present or DEC
  	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit		/ Save unit number passed by ROMs(and kernel)
+ 	mov	r1,raip		/ save csr passed by ROMs (and kernel)
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 101,107 ****
  
  / On error, restart from here.
  restart:
! 
  / clear core to make things clean
  2:
  	clr	(r0)+
--- 93,99 ----
  
  / On error, restart from here.
  restart:
! 	clr	r0
  / clear core to make things clean
  2:
  	clr	(r0)+
***************
*** 111,117 ****
  / RA initialize controller
  /
  	mov	$RASTEP1,r0
! 	mov	$raip,r1
  	clr	(r1)+			/ go through controller init seq.
  	mov	$icons,r2
  1:
--- 103,109 ----
  / RA initialize controller
  /
  	mov	$RASTEP1,r0
! 	mov	raip,r1
  	clr	(r1)+			/ go through controller init seq.
  	mov	$icons,r2
  1:
***************
*** 124,130 ****
  	mov	$ra+RACMDREF,*$ra+RACMDL
  	mov	$RASTCON,r0
  	jsr	pc,racmd
! 	mov	$unit,*$ra+RAUNIT	/ bring boot unit online
  	mov	$RAONLIN,r0
  	jsr	pc,racmd
  
--- 116,122 ----
  	mov	$ra+RACMDREF,*$ra+RACMDL
  	mov	$RASTCON,r0
  	jsr	pc,racmd
! 	mov	unit,*$ra+RAUNIT	/ bring boot unit online
  	mov	$RAONLIN,r0
  	jsr	pc,racmd
  
***************
*** 214,221 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	jmp	restart
  
--- 206,215 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit, r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	raip,r1
  	jsr	pc,*$0
  	jmp	restart
  
***************
*** 285,297 ****
  /
  racmd:
  	movb	r0,*$ra+RAOPCODE	/ fill in command type
! 	mov	$MSCPSIZE,r0
! 	mov	r0,*$ra+RARSPS		/ give controller struct sizes
! 	mov	r0,*$ra+RACMDS
! 	mov	$RASEMAP,r0
! 	mov	r0,*$ra+RARSPH		/ set mscp semaphores
! 	mov	r0,*$ra+RACMDH
! 	mov	raip,r0			/ tap controllers shoulder
  	mov	$ra+RACMDI,r0
  1:
  	tst	(r0)
--- 279,289 ----
  /
  racmd:
  	movb	r0,*$ra+RAOPCODE	/ fill in command type
! 	mov	$MSCPSIZE,*$ra+RARSPS	/ give controller struct sizes
! 	mov	$MSCPSIZE,*$ra+RACMDS
! 	mov	$RASEMAP,*$ra+RARSPH	/ set mscp semaphores
! 	mov	$RASEMAP,*$ra+RACMDH
! 	mov	*raip,r0		/ tap controllers shoulder
  	mov	$ra+RACMDI,r0
  1:
  	tst	(r0)
***************
*** 310,315 ****
--- 302,309 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0				/ unit number from ROMs
+ raip: 0				/ csr address from ROMs
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
***************
*** 317,320 ****
  buf = inod+INOSIZ
  bno = buf+BSIZE
  dno = bno+2
! ra = dno+2			/ ra mscp communications area (BIG!)
--- 311,314 ----
  buf = inod+INOSIZ
  bno = buf+BSIZE
  dno = bno+2
! ra = dno + 2			/ ra mscp communications area (BIG!)
*** /usr/src/sys/mdec.old/rkuboot.s	Wed May 23 13:00:47 1990
--- /usr/src/sys/mdec/rkuboot.s	Wed Apr 24 10:08:22 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 6			/ major # from bdevsw[]
+ 
  / RK05 bootstrap.
  /
  / disk boot program to load and transfer
***************
*** 38,44 ****
--- 40,51 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 50,58 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 57,64 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 59,65 ****
  	blo	2b
  
  / initialize rk
! 	mov	$reset+go,*$rkcs	/ reset controller
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 65,72 ----
  	blo	2b
  
  / initialize rk
! 	mov	csr,r1
! 	mov	$reset+go,rkcs(r1)	/ reset controller
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 147,154 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 154,163 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 193,202 ****
  reset	= 0
  go	= 1
  
! rkcs	= 177404
! rkda	= 177412
! rkwc	= 177406
! rkba	= 177410
  / rk05 disk driver.
  / low order address in dno,
  / high order in r0.
--- 202,211 ----
  reset	= 0
  go	= 1
  
! rkcs	= 0		/ offset from base csr
! rkwc	= 2
! rkba	= 4
! rkda	= 6
  / rk05 disk driver.
  / low order address in dno,
  / high order in r0.
***************
*** 209,220 ****
  	div	$12.,r0
  	ash	$4,r0
  	bis	r1,r0
! 	mov	r0,*$rkda	/ stuff disc address
! 	mov	$buf,*$rkba	/ where to put it.
! 	mov	$WC,*$rkwc	/ yes sir, yes sir, three bags full
! 	mov	$read+go,*$rkcs	/ press the button
  1:
! 	tstb	*$rkcs
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 218,233 ----
  	div	$12.,r0
  	ash	$4,r0
  	bis	r1,r0
! 	mov	unit,r3
! 	ash	$13.,r3
! 	bis	r3,r0
! 	mov	csr,r3
! 	mov	r0,rkda(r3)	/ stuff disc address
! 	mov	$buf,rkba(r3)	/ where to put it.
! 	mov	$WC,rkwc(r3)	/ yes sir, yes sir, three bags full
! 	mov	$read+go,(r3)	/ rkcs - press the button
  1:
! 	tstb	(r3)		/ rkcs
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 221,226 ****
--- 234,241 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/rluboot.s	Wed May 23 13:00:55 1990
--- /usr/src/sys/mdec/rluboot.s	Wed Apr 24 10:08:33 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 7			/ major # from bdevsw[]
+ 
  / RL01/02 bootstrap.
  /
  / disk boot program to load and transfer
***************
*** 11,18 ****
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
  
- mxvboot= 1		/ 0->normal, 1->adds check done by MXV11 boot ROMS
- 
  / constants:
  CLSIZE	= 2.			/ physical disk blocks per logical block
  CLSHFT	= 1.			/ shift to multiply by CLSIZE
--- 13,18 ----
***************
*** 38,51 ****
  / entry is made by jsr pc,*$0
  / so return can be rts pc
  
! .if	mxvboot
! 	0240			/ These two lines must be present or DEC MXV-11
  	br	start		/ boot ROMs will refuse to run boot block!
- .endif
  
  / establish sp, copy
  / program up to end of core.
  start:
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
--- 38,51 ----
  / entry is made by jsr pc,*$0
  / so return can be rts pc
  
! 	nop			/ These two lines must be present or DEC MXV-11
  	br	start		/ boot ROMs will refuse to run boot block!
  
  / establish sp, copy
  / program up to end of core.
  start:
+ 	movb	r0,unit+1	/ unit # in high byte
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 57,65 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 57,64 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 160,167 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 159,168 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	movb	unit+1,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 218,229 ****
  /		buf: buffer to read data into
  /
  /	Register usage:
! /		r1,r2,r3: used, but saved
! /		r0,r4 used and clobbered
! rlcs	= 174400
! rlba	= 174402
! rlda	= 174404
! rlmp	= 174406
  
  READ	= 14
  SEEK	= 6
--- 219,230 ----
  /		buf: buffer to read data into
  /
  /	Register usage:
! /		r1,r2: used, but saved
! /		r0,r3,r4 used and clobbered
! rlcs	= 0		/ offset from base csr
! rlba	= 2
! rlda	= 4
! rlmp	= 6
  
  READ	= 14
  SEEK	= 6
***************
*** 236,243 ****
  rblk:
  	mov	r1,-(sp)
  	mov	r2,-(sp)
! 	mov	r3,-(sp)
! 	mov	$rlcs,r4	/ point to controller
  	mov	dno,r1
  .if	CLSIZE-1
  	ashc	$CLSHFT,r0	/ multiply by CLSIZE
--- 237,243 ----
  rblk:
  	mov	r1,-(sp)
  	mov	r2,-(sp)
! 	mov	csr,r4
  	mov	dno,r1
  .if	CLSIZE-1
  	ashc	$CLSHFT,r0	/ multiply by CLSIZE
***************
*** 244,253 ****
  .endif
  	div	$RLSECT,r0	/ cylinder number - surface
  	asl	r1		/ sector number
! 	mov	$RDHDR,(r4)	/ find where the heads are now
! 7:	bit	$CRDY,(r4)	/ wait for the STUPID!!! controller
! 	beq	7b
! 	mov	*$rlmp,r2
  	ash	$-7,r2
  	bic	$!777,r2	/ we are at this cylinder now
  	mov	r0,r3
--- 244,255 ----
  .endif
  	div	$RLSECT,r0	/ cylinder number - surface
  	asl	r1		/ sector number
! 	mov	unit,-(sp)
! 	bis	$RDHDR,(sp)
! 	mov	(sp)+,(r4)	/ find where the heads are now
! 7:	tstb	(r4)		/ wait for the STUPID!!! controller (CRDY=200)
! 	bpl	7b
! 	mov	rlmp(r4),r2
  	ash	$-7,r2
  	bic	$!777,r2	/ we are at this cylinder now
  	mov	r0,r3
***************
*** 259,290 ****
  	bis	$SEEKHI,r2	/ up
  	br	2f
  1:	ash	$7,r2
! 	bis	$SEEKLO,r2	/ down
  2:	mov	r0,r3		/ compute desired disk surface
  	bic	$!1,r3
  	ash	$4,r3
  	bis	r3,r2
! 	mov	r2,*$rlda	/ disk address for seek
! 	mov	$SEEK,(r4)	/ do the seek
! 7:	bit	$CRDY,(r4)	/ wait for the STUPID!!! controller
! 	beq	7b
  	ash	$6,r0		/ compute disk address for read
  	bis	r1,r0
! 	add	$6,r4		/ point to rlmp
  	mov	$WC,(r4)	/ word count for read
  	mov	r0,-(r4)	/ disk address for read
  	mov	$buf,-(r4)	/ buffer address for read
! 	mov	$READ,-(r4)	/ do the read
! 7:	bit	$CRDY,(r4)	/ wait for the STUPID!!! controller
! 	beq	7b
! 	mov	(sp)+,r3
  	mov	(sp)+,r2
  	mov	(sp)+,r1
- 9:
  	rts	pc
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
--- 261,296 ----
  	bis	$SEEKHI,r2	/ up
  	br	2f
  1:	ash	$7,r2
! 	inc	r2		/ down (SEEKLO = 1, so just do 'inc')
  2:	mov	r0,r3		/ compute desired disk surface
  	bic	$!1,r3
  	ash	$4,r3
  	bis	r3,r2
! 	mov	r2,rlda(r4)	/ disk address for seek
! 	mov	unit,-(sp)
! 	bis	$SEEK,(sp)
! 	mov	(sp)+,(r4)	/ do the seek
! 7:	tstb	(r4)		/ wait for the STUPID!!! controller
! 	bpl	7b
  	ash	$6,r0		/ compute disk address for read
  	bis	r1,r0
! 	add	$rlmp,r4	/ point to rlmp
  	mov	$WC,(r4)	/ word count for read
  	mov	r0,-(r4)	/ disk address for read
  	mov	$buf,-(r4)	/ buffer address for read
! 	mov	unit,-(sp)
! 	bis	$READ,(sp)
! 	mov	(sp)+,-(r4)	/ do the read
! 7:	tstb	(r4)		/ wait for the STUPID!!! controller
! 	bpl	7b
  	mov	(sp)+,r2
  	mov	(sp)+,r1
  	rts	pc
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/rm03uboot.s	Wed May 23 13:01:02 1990
--- /usr/src/sys/mdec/rm03uboot.s	Wed Apr 24 10:08:36 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 10.			/ major # from bdevsw[]
+ 
  / RM02/03/05 bootstrap
  /
  / disk boot program to load and transfer
***************
*** 8,15 ****
  / must be removed
  
  RM05	= 0		/ 0-> RM02/03, 1-> RM05
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
  
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
--- 10,15 ----
***************
*** 42,48 ****
--- 42,53 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 54,62 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 59,66 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 63,71 ****
  	blo	2b
  
  / initialize disk
! 	mov	$drive,*$rmcs2
! 	mov	$preset+go,*$rmcs1
! 	mov	$fmt22,*$rmof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 67,76 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	unit,rmcs2(r1)
! 	mov	$preset+go,rmcs1(r1)
! 	mov	$fmt22,rmof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 153,160 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 158,167 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 207,213 ****
  NTRAK	= 5.		/ RM02/03
  .endif
  
! rmcs1	= 176700
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
--- 214,220 ----
  NTRAK	= 5.		/ RM02/03
  .endif
  
! rmcs1	= 0
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
***************
*** 224,244 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$rmca
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$rmda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 231,250 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! 	mov	csr,r3
! 	mov	r0,rmca(r3)
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	add	$rmcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 245,250 ****
--- 251,258 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/rm05uboot.s	Wed May 23 13:01:08 1990
--- /usr/src/sys/mdec/rm05uboot.s	Wed Apr 24 10:08:46 1991
***************
*** 1,3 ****
--- 1,4 ----
+ MAJOR = 10.			/ major # from bdevsw[]
  
  / RM02/03/05 bootstrap
  /
***************
*** 9,16 ****
  / must be removed
  
  RM05	= 1		/ 0-> RM02/03, 1-> RM05
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
  
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
--- 10,15 ----
***************
*** 43,49 ****
--- 42,53 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 55,63 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 59,66 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 64,72 ****
  	blo	2b
  
  / initialize disk
! 	mov	$drive,*$rmcs2
! 	mov	$preset+go,*$rmcs1
! 	mov	$fmt22,*$rmof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 67,76 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	unit,rmcs2(r1)
! 	mov	$preset+go,rmcs1(r1)
! 	mov	$fmt22,rmof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 154,161 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 158,167 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 208,214 ****
  NTRAK	= 5.		/ RM02/03
  .endif
  
! rmcs1	= 176700
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
--- 214,220 ----
  NTRAK	= 5.		/ RM02/03
  .endif
  
! rmcs1	= 0
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
***************
*** 225,245 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$rmca
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$rmda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 231,250 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! 	mov	csr,r3
! 	mov	r0,rmca(r3)
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	add	$rmcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 246,251 ****
--- 251,258 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/si51uboot.s	Wed May 23 13:01:20 1990
--- /usr/src/sys/mdec/si51uboot.s	Wed Apr 24 10:08:49 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 10.			/ major # from bdevsw[]
+ 
  / Fujitsu Eagle (2351A) on SI 6100 Controller bootstrap
  / Actually just a small modification of the RM02/03/05 bootstrap
  /
***************
*** 8,17 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
- address = 176700
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 10,15 ----
***************
*** 43,49 ****
--- 41,52 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 55,63 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 58,65 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 64,72 ****
  	blo	2b
  
  / initialize disk
! 	mov	$drive,*$rmcs2
! 	mov	$preset+go,*$rmcs1
! 	mov	$fmt22,*$rmof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 66,75 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	unit,rmcs2(r1)
! 	mov	$preset+go,rmcs1(r1)
! 	mov	$fmt22,rmof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 154,161 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 157,166 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 203,209 ****
  NSECT	= 48.
  NTRAK	= 20.		/ SI 6100 with Fujitsu 2351A
  
! rmcs1	= address
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
--- 208,214 ----
  NSECT	= 48.
  NTRAK	= 20.		/ SI 6100 with Fujitsu 2351A
  
! rmcs1	= 0
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
***************
*** 220,240 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$rmca
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$rmda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 225,244 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! 	mov	csr,r3
! 	mov	r0,rmca(r3)
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	add	$rmcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 241,246 ****
--- 245,252 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/si94uboot.s	Wed May 23 13:01:27 1990
--- /usr/src/sys/mdec/si94uboot.s	Wed Apr 24 10:08:53 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 10.			/ major # from bdevsw[]
+ 
  / Fujitsu 160 on SI 9400 or Emulex SC01B Controller bootstrap
  / Actually just a small modification of the RM02/03/05 bootstrap
  /
***************
*** 8,17 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
- address = 176700
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 10,15 ----
***************
*** 43,49 ****
--- 41,52 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 55,63 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 58,65 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 64,72 ****
  	blo	2b
  
  / initialize disk
! 	mov	$drive,*$rmcs2
! 	mov	$preset+go,*$rmcs1
! 	mov	$fmt22,*$rmof
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 66,75 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	unit,rmcs2(r1)
! 	mov	$preset+go,rmcs1(r1)
! 	mov	$fmt22,rmof(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 154,161 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 157,166 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 203,209 ****
  NSECT	= 32.
  NTRAK	= 10.		/ SI 9400 with Fujitsu 160
  
! rmcs1	= address
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
--- 208,214 ----
  NSECT	= 32.
  NTRAK	= 10.		/ SI 9400 with Fujitsu 160
  
! rmcs1	= 0
  rmda	= rmcs1+6
  rmcs2	= rmcs1+10
  rmds	= rmcs1+12
***************
*** 220,240 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
! 	mov	r0,*$rmca
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	mov	$rmda,r1
! 	mov	r0,(r1)
! 	mov	$buf,-(r1)
! 	mov	$WC,-(r1)
! 	mov	$read+go,-(r1)
  1:
! 	tstb	(r1)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 225,244 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! 	mov	csr,r3
! 	mov	r0,rmca(r3)
  	clr	r0
  	div	$NSECT,r0
  	swab	r0
  	bis	r1,r0
! 	add	$rmcs2,r3
! 	mov	unit,(r3)
! 	mov	r0,-(r3)
! 	mov	$buf,-(r3)
! 	mov	$WC,-(r3)
! 	mov	$read+go,-(r3)
  1:
! 	tstb	(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 241,246 ****
--- 245,252 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack
*** /usr/src/sys/mdec.old/si95uboot.s	Wed May 23 13:01:34 1990
--- /usr/src/sys/mdec/si95uboot.s	Wed Apr 24 10:09:02 1991
***************
*** 1,3 ****
--- 1,5 ----
+ MAJOR = 9.			/ major # from bdevsw[]
+ 
  / CDC 9766 disk on SI 9500 Controller bootstrap
  /
  / disk boot program to load and transfer
***************
*** 7,15 ****
  / assembled size must be <= 512; if > 494, the 16-byte a.out header
  / must be removed
  
- drive	= 0		/ unit to boot from
- cyl	= 0.		/ cylinder offset of filesys to read from
- 
  / options: none.  all options of reading an alternate name or echoing to
  /		  the keyboard had to be removed to make room for the 
  /		  code which understands the new directory structure on disc
--- 9,14 ----
***************
*** 43,49 ****
--- 42,53 ----
  
  / establish sp, copy
  / program up to end of core.
+ 
+ 	nop			/ These two lines must be present or DEC
+ 	br	start		/ boot ROMs will refuse to run boot block!
  start:
+ 	mov	r0,unit
+ 	mov	r1,csr
  	mov	$..,sp
  	mov	sp,r1
  	clr	r0
***************
*** 55,63 ****
  
  / On error, restart from here.
  restart:
- 
- / clear core to make things clean
  	clr	r0
  2:
  	clr	(r0)+
  	cmp	r0,sp
--- 59,66 ----
  
  / On error, restart from here.
  restart:
  	clr	r0
+ / clear core to make things clean
  2:
  	clr	(r0)+
  	cmp	r0,sp
***************
*** 64,70 ****
  	blo	2b
  
  / initialize disk
! 	mov	$reset,*$sicnr
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
--- 67,74 ----
  	blo	2b
  
  / initialize disk
! 	mov	csr,r1
! 	mov	$reset,sicnr(r1)
  
  	mov	$bootnm, r1
  	mov	$2,r0			/ ROOTINO
***************
*** 152,159 ****
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	ENDCORE-BOOTDEV, r3
  	mov	ENDCORE-CHECKWORD, r2
  	jsr	pc,*$0
  	br	restart
  
--- 156,165 ----
  / restart if return
  2:
  	mov	ENDCORE-BOOTOPTS, r4
! 	mov	unit,r3
! 	bis	$MAJOR\<8.,r3
  	mov	ENDCORE-CHECKWORD, r2
+ 	mov	csr,r1
  	jsr	pc,*$0
  	br	restart
  
***************
*** 200,206 ****
  NSECT	= 32.
  NTRAK	= 19.		/ 9766
  
! sicnr	= 176700
  siwcr	= sicnr+2
  sipcr	= sicnr+4
  sihsr	= sicnr+6
--- 206,212 ----
  NSECT	= 32.
  NTRAK	= 19.		/ 9766
  
! sicnr	= 0
  siwcr	= sicnr+2
  sipcr	= sicnr+4
  sihsr	= sicnr+6
***************
*** 218,258 ****
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! .if	cyl
! 	add	$cyl,r0
! .endif
  .if	shared
  	mov	r0,-(sp)		/ push onto stack
! 	mov	*$siscr,r0		/ load shared computer register
  	bit	$200,r0			/ see if grant bit set
  	bne	1f			/ if so, is dual ported
! 	mov	*$sierr,r0		/ move error register to r0
  	bic	$037777,r0		/ clear all but top two bits
  	cmp	$140000,r0		/ see if contention error
  	bne	2f			/ if not, not dual ported
  1:
! 	bit	$200,*$siscr		/ test for grant
  	bne	2f			/ if set, go do command
! 	clr	*$sicnr			/ issue logic master clear
! 	mov	$1,*$siscr		/ request grant
  	br	1b			/ loop until grant
  2:
  	mov	(sp)+,r0		/ pop off stack
  .endif
! 	mov	r0,*$sipcr
! 	mov	$drive,r0
  	ash	$10.,r0
! 	add	r0,*$sipcr		/ port and cylinder
  	clr	r0
  	div	$NSECT,r0
  	ash	$5.,r0
  	bis	r0,r1
! 	mov	r1,*$sihsr		/ head and sector
! 	mov	$buf,*$simar		/ buffer address
! 	mov	$WC,*$siwcr		/ word count
! 	mov	$read+go,*$sicnr	/ read it
  1:
! 	tstb	*$sicnr
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
--- 224,262 ----
  	ashc	$CLSHFT,r0		/ multiply by CLSIZE
  .endif
  	div	$NSECT*NTRAK,r0
! 	mov	csr,r3
  .if	shared
  	mov	r0,-(sp)		/ push onto stack
! 	mov	siscr(r3),r0		/ load shared computer register
  	bit	$200,r0			/ see if grant bit set
  	bne	1f			/ if so, is dual ported
! 	mov	sierr(r3),r0		/ move error register to r0
  	bic	$037777,r0		/ clear all but top two bits
  	cmp	$140000,r0		/ see if contention error
  	bne	2f			/ if not, not dual ported
  1:
! 	bit	$200,siscr(r3)		/ test for grant
  	bne	2f			/ if set, go do command
! 	clr	sicnr(r3)		/ issue logic master clear
! 	mov	$1,siscr(r3)		/ request grant
  	br	1b			/ loop until grant
  2:
  	mov	(sp)+,r0		/ pop off stack
  .endif
! 	mov	r0,sipcr(r3)		/ port and cylinder
! 	mov	unit,r0
  	ash	$10.,r0
! 	add	r0,sipcr(r3)		/ add in unit number
  	clr	r0
  	div	$NSECT,r0
  	ash	$5.,r0
  	bis	r0,r1
! 	mov	r1,sihsr(r3)		/ head and sector
! 	mov	$buf,simar(r3)		/ buffer address
! 	mov	$WC,siwcr(r3)		/ word count
! 	mov	$read+go,sicnr(r3)	/ read it
  1:
! 	tstb	sicnr(r3)
  	bge	1b
  	mov	(sp)+,r1
  	rts	pc
***************
*** 259,264 ****
--- 263,270 ----
  
  bootnm:	<boot\0\0>
  bootlen = 4			/ strlen(bootnm)
+ unit: 0
+ csr: 0
  end:
  
  inod = ..-512.-BSIZE		/ room for inod, buf, stack

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 5 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 5 of 22

The external packet area for the [T]MSCP drivers is allocated here.
Enough room is allocated to handle 2 TMSCP plus 2 MSCP controllers.

The reference to 'ubmap' was removed, it's defined in uba.h.

*** /usr/src/sys/pdp/machdep2.c.old	Thu May 31 14:00:35 1990
--- /usr/src/sys/pdp/machdep2.c	Sat Apr 20 23:32:44 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)machdep.c	1.2 (2.10BSD Berkeley) 1/26/90
   */
  
  #include "param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)machdep.c	2.0 (2.11BSD) 4/20/91
   */
  
  #include "param.h"
***************
*** 27,32 ****
--- 27,34 ----
  #include "ram.h"
  #include "msgbuf.h"
  #include "namei.h"
+ #include "ra.h"
+ #include "tms.h"
  
  #ifdef QUOTA
  #include "quota.h"
***************
*** 33,38 ****
--- 35,45 ----
  #endif
  
  size_t	physmem;	/* total amount of physical memory (for savecore) */
+ #if	NRAC > 0 || NTMSCP > 0
+ memaddr	_iostart, _iobase;
+ ubadr_t	_ioumr;
+ u_short	_iosize = 2 * (1928 + 1096 + 128);  /* enough for 2 TMSCP and 2 MSCP */
+ #endif
  
  #ifndef	NOKA5
  segm	seg5;		/* filled in by initialization */
***************
*** 172,177 ****
--- 179,216 ----
  	maxmem -= B;
  	}
  
+ #if	NRAC > 0 || NTMSCP > 0
+ {
+ 	register int s, first;
+ 	register struct ubmap *ubp;
+ 	long paddr;
+ 
+ 	if ((_iobase = malloc(coremap, btoc(_iosize))) == 0)
+ 		panic("_iobase");
+ 	maxmem -= btoc(_iosize);
+ #ifdef	UNIBUS_MAP
+ 	if (ubmap) {
+ 		_iostart = _iobase;
+ 		s = (int)btoub(_iosize);
+ /*
+  * this early in the system's life there had better be a UMR or two
+  * available!!
+ */
+ 		first = malloc(ub_map, s);
+ 		_ioumr = (ubadr_t)first << 13;
+ 		ubp = &UBMAP[first];
+ 		paddr = ctob((ubadr_t)_iostart);
+ 		while (s--) {
+ 			ubp->ub_lo = loint(paddr);
+ 			ubp->ub_hi = hiint(paddr);
+ 			ubp++;
+ 			paddr += (ubadr_t)UBPAGE;
+ 		}
+ 	}
+ #endif	UNIBUS_MAP
+ }
+ #endif	NRAC
+ 
  #define B	(size_t)(((long)nbuf * (MAXBSIZE)) / ctob(1))
  	if ((bpaddr = malloc(coremap, B)) == 0)
  		panic("buffers");
***************
*** 282,288 ****
  #endif
  
  #ifdef UNIBUS_MAP
- extern bool_t ubmap;
  
  /*
   * Re-initialize the Unibus map registers to statically map
--- 321,326 ----
***************
*** 363,369 ****
  			if (nbusy == 0)
  				break;
  			printf("%d ", nbusy);
! 			DELAY(40000L * iter);
  		  }
  		}
  		printf("done\n");
--- 401,407 ----
  			if (nbusy == 0)
  				break;
  			printf("%d ", nbusy);
! 			delay(40000L * iter);
  		  }
  		}
  		printf("done\n");
***************
*** 420,422 ****
--- 458,486 ----
  		}
  	}
  }
+ 
+ #if	NRAC > 0 || NTMSCP > 0
+ memaddr
+ _ioget(size)
+ 	u_int size;
+ 	{
+ 	register memaddr base;
+ 	register u_int csize;
+ 
+ 	csize = btoc(size);
+ 	size = ctob(csize);
+ 	if (size > _iosize)
+ 		return(0);
+ 	_iosize -= size;
+ 	base = _iobase;
+ 	_iobase += csize;
+ 	return(base);
+ 	}
+ 
+ ubadr_t
+ _iomap(addr)
+ 	register memaddr addr;
+ 	{
+ 	return(((ubadr_t)(addr - _iostart) << 6) + _ioumr);
+ 	}
+ #endif NRAC

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 6 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 6 of 22

The booting device's CSR and unit number being passed from 'boot'
are saved for later use in a [auto]reboot.

*** /usr/src/sys/pdp/mch_start.s.old	Mon Jul  4 13:07:21 1988
--- /usr/src/sys/pdp/mch_start.s	Sat Apr 20 21:44:52 1991
***************
*** 64,69 ****
--- 64,71 ----
  	beq	1f
  	mov	$RB_SINGLE,r4		/   r4 = RB_SINGLE
  1:
+ 	mov	r1,_bootcsr		/ save boot controller csr
+ 	mov	r3,_bootdev		/ save boot device major,unit
  	mov	r4,_boothowto		/ save boot flags
  	mov	$_initflags+6,r2	/ get a pointer to the \0 in _initflags
  	mov	r4,r1			/ r1 = boot options
***************
*** 99,105 ****
   * Icode is copied out to process 1 to exec /etc/init.
   * If the exec fails, process 1 exits.
   */
! .globl	_initflags, _szicode, _boothowto
  
  ENTRY(icode)
  	mov	$argv-_icode,-(sp)
--- 101,107 ----
   * Icode is copied out to process 1 to exec /etc/init.
   * If the exec fails, process 1 exits.
   */
! .globl	_initflags, _szicode, _boothowto, _bootcsr, _bootdev
  
  ENTRY(icode)
  	mov	$argv-_icode,-(sp)
***************
*** 120,125 ****
--- 122,131 ----
  	_szicode-_icode
  _boothowto:
  	0				/ boot flags passed by boot
+ _bootdev:
+ 	0				/ boot major#,unit
+ _bootcsr:
+ 	0				/ csr of booting controller
  .text
  
  

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 7a of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 7a of 22 

Because part 7 was so large it was split into two (still large)
pieces.  The two parts (7a and 7b) should be joined together with no 
intervening text.

/sys/pdpstand/* was basically rewritten.  All of the drivers were
modified to support at least 2 controllers.  The device array in
'conf.c' was placed in major device number order (see bdevsw[] in
/sys/pdp/conf.c)

The files tmscpboot.s and tmscptape.data should be removed, they
are no longer needed now that 'mtboot.s' can handle all 4 controller
types.

The switch register is no longer examined for cpu or drive type (xp)
information.

The return protocol for the standalone utilities was changed to prevent
slightly oversized programs from wiping out the 'rtt' information stored
at 0140000.  A higher address at the top (rather than the bottom) of the
stack is now used.

*** /usr/src/sys/pdpstand.old/M.s	Fri Aug 19 12:03:46 1988
--- /usr/src/sys/pdpstand/M.s	Tue Apr 23 10:21:47 1991
***************
*** 1,9 ****
  /
  /	SCCS id	@(#)M.s	1.7 (Berkeley)	7/11/83
  /
  / Startup code for two-stage bootstrap with support for autoboot.
! / Supports 11/40, 11/45, 11/70, 11/23, 11/23+I/O map (11/24), 11/73
! / and similar machines.
  
  systrap = 104400	/ trap 0
  
--- 1,9 ----
  /
  /	SCCS id	@(#)M.s	1.7 (Berkeley)	7/11/83
+ /		@(#)M.s	2.0 (2.11BSD)	4/12/91 (sms@wlv.imsd.contel.com)
  /
  / Startup code for two-stage bootstrap with support for autoboot.
! / Supports 11/45, 11/70, 11/53, 11/73, 11/83, 11/84, 11/93, 11/94
  
  systrap = 104400	/ trap 0
  
***************
*** 14,21 ****
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4
! CHECKWORD=	6
  
  .globl	_end
  .globl	_main,_ubmapset
--- 14,21 ----
  ENDCORE=	160000		/ end of core, mem. management off
  SZFLAGS=	6		/ size of boot flags
  BOOTOPTS=	2		/ location of options, bytes below ENDCORE
! BOOTDEV=	4		/ makedev(major,unit)
! CHECKWORD=	6		/ ~BOOTOPTS
  
  .globl	_end
  .globl	_main,_ubmapset
***************
*** 54,59 ****
--- 54,60 ----
  	mov	r4,_bootopts
  	mov	r3,_bootdev
  	mov	r2,_checkword
+ 	mov	r1,_bootcsr		/ 'boot' will apply ADJcsr[] correction
  /clobber any boot flags left in memory
  	clr	ENDCORE-BOOTOPTS
  	clr	ENDCORE-BOOTDEV
***************
*** 60,101 ****
  	clr	ENDCORE-CHECKWORD
  /
  / determine what kind of cpu we are running on
! / first, check switches. if they are 40, 24, 44, 45, 70, or 73
! / set appropriately
! /
  	clrb	_sep_id
  	clrb	_ubmap
- 	clrb	_haveCSW
- 	mov	$2f,nofault	/ check if we even have switches!
- 	tst	*$SWREG
- 	clr	nofault		/ apparently we do
- 	incb	_haveCSW
- 	mov	$40.,r0
- 	cmp	*$SWREG,$40
- 	beq	gotcha
- 	cmp	*$SWREG,$24
- 	bne	1f
- 	mov	$24.,r0
- 	incb	_ubmap
- 	jbr	gotcha
- 1:
- 	cmp	*$SWREG,$45
- 	bne	1f
- 	mov	$45.,r0
- 	incb	_sep_id
- 	jbr	gotcha
- 1:
- 	cmp	*$SWREG,$70
- 	bne	2f
- 	mov	$70.,r0
- 	incb	_sep_id
- 	incb	_ubmap
- 	jbr	gotcha
- /
- / if we can't find out from switches,
- / explore and see what we find
- /
- 2:
  	mov	$40.,r0		/ assume 11/40
  	mov	$2f,nofault
  	mov	*$KDSA6,r1	/ then we have sep i/d 45, 70, 73
--- 61,77 ----
  	clr	ENDCORE-CHECKWORD
  /
  / determine what kind of cpu we are running on
! / The check for the switch register removed because:  1) the only use
! / of it was in xp.c for the drive type and an alternate method of 
! / modifying xptype is provided, 2) the only machine with a front panel
! / which can run the system is the 11/70 and i got tired of having the
! / system think it was on a 11/40 because switches were left up after the
! / boot, 3) the standalone code was becoming large enough that 'restor'
! / was having size problems due to the addition of multi-controller support,
! / 4) the probing proceedure adequately determines the hardware capabilities.
! 
  	clrb	_sep_id
  	clrb	_ubmap
  	mov	$40.,r0		/ assume 11/40
  	mov	$2f,nofault
  	mov	*$KDSA6,r1	/ then we have sep i/d 45, 70, 73
***************
*** 120,126 ****
  	incb	_ubmap
  	mov	$24.,r0		/ unibus map, no sep. I/D = 24
  1:	clr	nofault
- gotcha:
  	mov	r0,_cputype
  
  /
--- 96,101 ----
***************
*** 150,159 ****
  / physical addressing is completely reworked, 3*64Kb is probably the
  / highest we'll ever see boot relocated.  This means that the maximum size
  / of any program boot can load is 192Kb.  That size includes text, data
! / and bss.  This is a problem for the current (9/87) networking kernels
! / which have the networking code and data space incorporated as part of
! / the main line kernel.  Which only adds more impetus to get the networking
! / put into supervisor space ...
  
  N	= 3			/ 3*64Kb = 192Kb
  
--- 125,131 ----
  / physical addressing is completely reworked, 3*64Kb is probably the
  / highest we'll ever see boot relocated.  This means that the maximum size
  / of any program boot can load is 192Kb.  That size includes text, data
! / and bss.
  
  N	= 3			/ 3*64Kb = 192Kb
  
***************
*** 224,240 ****
  	mtpi	(r1)+
  	sob	r0,1b
  
  
- / continue execution in user space copy; return protocol uses
- / absolute address 140000.
- 	mov	$140004,sp
- 	tstb	_sep_id
- 	bne	1f
- 	clr	*$KISA6
- 	br	2f
- 1:
- 	clr	*$KDSA6
- 2:
  	mov	$140340,-(sp)
  	mov	$user,-(sp)
  	rtt
--- 196,204 ----
  	mtpi	(r1)+
  	sob	r0,1b
  
+ / continue execution in user space copy.  No sense in loading sp with
+ / anything special since the call to _main below overwrites low core.
  
  	mov	$140340,-(sp)
  	mov	$user,-(sp)
  	rtt
***************
*** 257,265 ****
--- 221,233 ----
  
  	jsr	pc,_main
  	mov	_cputype,r0
+ 	mov	_bootcsr,r1	/ csr of boot controller (from ROMs)
+ 	mov	_bootdev,r3	/ makedev(major,unit) (from ROMs & bootblock)
  	mov	_bootopts,r4
  	mov	r4,r2
  	com	r2		/ checkword
+ 	mov	$160000,-(sp)	/ set ksp to very top so that the trap
+ 	mtpi	sp		/ puts the return address and psw at 157774,6
  	systrap
  
  	br	user
***************
*** 343,360 ****
  
  trap:
  	mov	*$PS,-(sp)
- 	mov	r0,-(sp)
- 	mov	r1,-(sp)
  	tst	nofault
  	bne	3f
  	jsr	pc,_trap
  	mov	(sp)+,r1
  	mov	(sp)+,r0
  	tst	(sp)+
  	rtt
! 3:	mov	(sp)+,r1
! 	mov	(sp)+,r0
! 	tst	(sp)+
  	mov	nofault,(sp)
  	rtt
  
--- 311,326 ----
  
  trap:
  	mov	*$PS,-(sp)
  	tst	nofault
  	bne	3f
+ 	mov	r0,-(sp)
+ 	mov	r1,-(sp)
  	jsr	pc,_trap
  	mov	(sp)+,r1
  	mov	(sp)+,r0
  	tst	(sp)+
  	rtt
! 3:	tst	(sp)+
  	mov	nofault,(sp)
  	rtt
  
***************
*** 364,383 ****
  SSR2	= 177576
  SSR3	= 172516
  KISA0	= 172340
- KISA1	= 172342
  KISA6	= 172354
- KISA7	= 172356
  KISD0	= 172300
  KISD7	= 172316
  KDSA0	= 172360
  KDSA6	= 172374
- KDSA7	= 172376
  KDSD0	= 172320
- KDSD5	= 172332
- SISA0	= 172240
- SISA1	= 172242
- SISD0	= 172200
- SISD1	= 172202
  UISA0	= 177640
  UISD0	= 177600
  UDSA0	= 177660
--- 330,341 ----
***************
*** 384,403 ****
  UDSD0	= 177620
  MSCR	= 177746	/ 11/44/60/70 memory system cache control register
  IO	= 177600
- SWREG	= 177570
  UBMAP	= 170200
  
  .data
  .globl	_cputype
! .globl	_ksep, _sep_id, _ubmap, _haveCSW
! .globl	_bootopts, _bootdev, _checkword
  
  nofault:	.=.+2	/ where to go on predicted trap
  _cputype:	.=.+2	/ cpu type (currently 40,45 or 70)
  _sep_id:	.=.+1	/ 1 if we have separate I and D
- _ubmap:		.=.+1	/ 1 if we have a unibus map
- _haveCSW:	.=.+1	/ 1 if we have a console switch register
  _ksep:		.=.+1	/ 1 if kernel mode has sep I/D enabled
  _bootopts:	.=.+2	/ flags if an autoboot
! _bootdev:	.=.+2	/ device to get unix from, if not RB_ASKNAME
  _checkword:	.=.+2	/ saved r2, complement of bootopts if an autoboot
--- 342,360 ----
  UDSD0	= 177620
  MSCR	= 177746	/ 11/44/60/70 memory system cache control register
  IO	= 177600
  UBMAP	= 170200
  
  .data
  .globl	_cputype
! .globl	_ksep, _sep_id, _ubmap
! .globl	_bootopts, _bootdev, _checkword, _bootcsr
  
  nofault:	.=.+2	/ where to go on predicted trap
  _cputype:	.=.+2	/ cpu type (currently 40,45 or 70)
  _sep_id:	.=.+1	/ 1 if we have separate I and D
  _ksep:		.=.+1	/ 1 if kernel mode has sep I/D enabled
+ _ubmap:		.=.+2	/ 1 if we have a unibus map
  _bootopts:	.=.+2	/ flags if an autoboot
! _bootdev:	.=.+2	/ device booted from
! _bootcsr:	.=.+2	/ csr of device booted from
  _checkword:	.=.+2	/ saved r2, complement of bootopts if an autoboot
*** /usr/src/sys/pdpstand.old/Makefile	Thu Dec 20 08:55:11 1990
--- /usr/src/sys/pdpstand/Makefile	Sun Apr 28 00:12:26 1991
***************
*** 41,47 ****
  	ht.o tm.o ts.o tmscp.o \
  	xp.o rk.o rl.o br.o hk.o si.o ra.o
  
! ALL=	mtboot boot mkfs restor icheck maketape tmscpboot
  
  .c.o:
  	cc ${CFLAGS} -c $*.c
--- 41,47 ----
  	ht.o tm.o ts.o tmscp.o \
  	xp.o rk.o rl.o br.o hk.o si.o ra.o
  
! ALL=	mtboot boot mkfs restor icheck maketape
  
  .c.o:
  	cc ${CFLAGS} -c $*.c
***************
*** 56,62 ****
  distribution: tape1 switch_tapes tape2
  
  tmscptape: ${ALL} ${DUMP}
! 	./maketape /dev/nr${TAPE} tmscptape.data
  	dd if=${DUMP} of=/dev/nr${TAPE} bs=20b
  	cd ${ROOT}/usr; tar cfb /dev/nr${TAPE} 20 \
  		adm bin dict doc games guest hosts include ingres lib \
--- 56,62 ----
  distribution: tape1 switch_tapes tape2
  
  tmscptape: ${ALL} ${DUMP}
! 	./maketape /dev/nr${TAPE} maketape.data
  	dd if=${DUMP} of=/dev/nr${TAPE} bs=20b
  	cd ${ROOT}/usr; tar cfb /dev/nr${TAPE} 20 \
  		adm bin dict doc games guest hosts include ingres lib \
***************
*** 115,125 ****
  mtboot: mtboot.o
  	strip $@.o
  	dd if=$@.o of=mtboot bs=16 skip=1
- 	rm -f $@.o
- 
- tmscpboot: tmscpboot.o
- 	strip $@.o
- 	dd if=$@.o of=tmscpboot bs=16 skip=1
  	rm -f $@.o
  
  boot: M.o conf.o boot.o ubmapset.o libsa.a
--- 115,120 ----
*** /usr/src/sys/pdpstand.old/Makefile.vax	Sun Nov  4 12:19:58 1990
--- /usr/src/sys/pdpstand/Makefile.vax	Sun Apr 28 00:13:32 1991
***************
*** 22,35 ****
  DUMP=	/xusr/root.dump
  TMP1=	/xusr/1st.tar
  TMP2=	/xusr/2nd.tar
- TMP3=	/tmp/maketape.data
  
  ROOT=	/xusr/root
  
  distribution: tape1 switch_tapes tape2
  
! tape1: ${TMP3} ${TMP2} ${TMP1}
! 	./maketape /dev/r${TAPE} ${TMP3}
  
  switch_tapes: FRC
  	@echo "Switch tapes.  Hit CR when second tape is mounted."
--- 22,34 ----
  DUMP=	/xusr/root.dump
  TMP1=	/xusr/1st.tar
  TMP2=	/xusr/2nd.tar
  
  ROOT=	/xusr/root
  
  distribution: tape1 switch_tapes tape2
  
! tape1: ${TMP2} ${TMP1}
! 	./maketape /dev/r${TAPE} maketape.data
  
  switch_tapes: FRC
  	@echo "Switch tapes.  Hit CR when second tape is mounted."
***************
*** 50,62 ****
  
  ${TMP2}:
  	cd ${ROOT}/usr/src; tar cf ${TMP2} sys include
- 
- ${TMP3}:
- 	cp tmscptape.data ${TMP3}
- #	cp maketape.data ${TMP3}
- 	echo "* 1" >> ${TMP3}
- 	echo ${DUMP} 20 >> ${TMP3}
- 	echo "* 1" >> ${TMP3}
- 	echo ${TMP1} 20 >> ${TMP3}
- 	echo "* 1" >> ${TMP3}
- 	echo ${TMP2} 20 >> ${TMP3}
--- 49,51 ----
*** /usr/src/sys/pdpstand.old/boot.c	Fri Aug 19 11:53:12 1988
--- /usr/src/sys/pdpstand/boot.c	Tue Apr 23 13:08:44 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)boot.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  #include "../h/param.h"
  #include "../machine/seg.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)boot.c	2.0 (2.11BSD) 4/20/91
   */
  #include "../h/param.h"
  #include "../machine/seg.h"
***************
*** 19,25 ****
  #	define	RB_DEFNAME	"xp(0,0)unix"
  #endif
  
! #undef	btoc
  #define	KB	* 1024L
  
  #define	KISD0	((u_short *) 0172300)
--- 19,25 ----
  #	define	RB_DEFNAME	"xp(0,0)unix"
  #endif
  
! #undef	btoc			/* to save space */
  #define	KB	* 1024L
  
  #define	KISD0	((u_short *) 0172300)
***************
*** 34,48 ****
  #define	SEG_TEXT	02
  #define	SEG_OVLY	04
  
! extern int	bootopts;	/* boot options from previous incarnation */
! extern int	bootdev;	/* UNIX dev we were booted from (not used) */
! extern int	checkword;	/* one's complements of bootopts */
! extern int	cputype;	/* 24, 40, 44, 45, 70, or 73 */
! extern bool_t	ksep;		/* is kernel mode currently separated */
! extern bool_t	sep_id;		/* does the cpu support separate I/D? */
  
  char		module[] = "Boot"; /* this program's name (used by trap) */
! char		line[100] = RB_DEFNAME;
  bool_t		overlaid = 0;
  u_short		pdrproto[16 + NOVL] = {0};
  struct exec	exec;
--- 34,51 ----
  #define	SEG_TEXT	02
  #define	SEG_OVLY	04
  
! extern	caddr_t	*bootcsr;	/* csr of boot controller */
! extern	int	bootopts;	/* boot options from previous incarnation */
! extern	int	bootdev;	/* makedev(major,unit) booted from */
! extern	int	checkword;	/* one's complements of bootopts */
! extern	int	cputype;	/* 24, 40, 44, 45, 70, or 73 */
! extern	bool_t	ksep;		/* is kernel mode currently separated */
! extern	bool_t	sep_id;		/* does the cpu support separate I/D? */
! extern	int	ndevsw;		/* number of devices in devsw[] */
! extern	char	ADJcsr[];	/* adjustments for ROM csr addresses */
  
  char		module[] = "Boot"; /* this program's name (used by trap) */
! char		line[64] = RB_DEFNAME;
  bool_t		overlaid = 0;
  u_short		pdrproto[16 + NOVL] = {0};
  struct exec	exec;
***************
*** 58,75 ****
  	struct	loadmap	*lt_map;
  };
  
- /*
-  * The 0401 references below are to a weird ULTRIX magic which signifies a
-  * stand alone 0407.  This entry is present so we can boot the ULTRIX boot if
-  * necessary (we can't load an ULTRIX kernel and most of the ULTRIX stand alone
-  * utilities for instance).
-  */
- #define	A_MAGICU	0401
- 
- struct	loadmap	load401[] = {
- 	SEG_DATA,	56 KB,
- 	0,		0  KB
- };
  struct	loadmap	load407[] = {
  	SEG_DATA,	56 KB,
  	0,		0  KB
--- 61,66 ----
***************
*** 126,132 ****
  };
  
  struct	loadtable	loadtable[] = {
- 	A_MAGICU,	load401,	/* ULTRIX boot */
  	A_MAGIC1,	load407,
  	A_MAGIC2,	load410,
  	A_MAGIC3,	load411,
--- 117,122 ----
***************
*** 136,146 ****
  
  main()
  {
! 	int i, j;
  	int retry = 0;
  	struct loadtable *setup();
  
! 	printf("\nboot: %d%s\n", cputype, module);
  	/*
  	 * The machine language will have gotten the bootopts
  	 * if we're an autoboot and will pass them along.
--- 126,160 ----
  
  main()
  {
! 	register int i, j, maj;
  	int retry = 0;
+ 	caddr_t	*adjcsr;
  	struct loadtable *setup();
+ 	struct iob *file;
+ 	char *rb = RB_DEFNAME;
  
! 	maj = major(bootdev);
! 	if (maj >= ndevsw) {
! 		printf("bootdev: 0%o", bootdev);
! 		_stop("bad major");
! 	}
! 	adjcsr = (caddr_t *)((short)bootcsr - ADJcsr[maj]);
! 	for (i = 0; devsw[maj].dv_csr != (caddr_t) -1; i++) {
! 		if (adjcsr == devsw[maj].dv_csr[i])
! 			break;
! 		if (devsw[maj].dv_csr[i] == 0) {
! 			devsw[maj].dv_csr[i] = adjcsr;
! 			break;
! 		}
! 	}
! 	if (devsw[maj].dv_csr[i] == (caddr_t *) -1) {
! 		printf("bootdev: 0%o", bootdev);
! 		_stop("no free csr slots");
! 	}
! 	bootdev &= ~(3 << 6);
! 	bootdev |= (i << 6);	/* controller # to bits 6&7 */
! 	printf("\n%d%s from %s(%d,0,0%o)\n", cputype, module, 
! 		devsw[major(bootdev)].dv_name, minor(bootdev), bootcsr);
  	/*
  	 * The machine language will have gotten the bootopts
  	 * if we're an autoboot and will pass them along.
***************
*** 156,167 ****
  		} else
  			printf(": %s\n", line);
  		if (line[0] == '\0') {
! 			printf(": %s\n", RB_DEFNAME);
! 			i = open(RB_DEFNAME, 0);
! 		} else
! 			i = open(line, 0);
  		j = -1;
  		if (i >= 0) {
  			j = checkunix(i, setup(i));
  			(void) close(i);
  		}
--- 170,182 ----
  		} else
  			printf(": %s\n", line);
  		if (line[0] == '\0') {
! 			printf(": %s\n", rb);
! 			strcpy(line, rb);
! 		}
! 		i = open(line, 0);
  		j = -1;
  		if (i >= 0) {
+ 			file = &iob[i - 3];	/* -3 for pseudo stdin/o/e */
  			j = checkunix(i, setup(i));
  			(void) close(i);
  		}
***************
*** 168,173 ****
--- 183,193 ----
  		if (++retry > 2)
  			bootopts = RB_SINGLE | RB_ASKNAME;
  	} while (j < 0);
+ 	i = file->i_ino.i_dev;
+ 	bootdev = makedev(i, file->i_unit);
+ 	bootcsr = devsw[i].dv_csr[(file->i_unit >> 6) & 3];
+ 	bootcsr = (caddr_t *)((short)bootcsr + ADJcsr[i]);
+ 	printf("%s: bootdev=0%o bootcsr=0%o\n", module, bootdev, bootcsr);
  }
  
  struct loadtable *
***************
*** 342,348 ****
  				 * If this is a 0407 style object, the text
  				 * and data are loaded together.
  				 */
! 				if (exec.a_magic != A_MAGIC1 && exec.a_magic != A_MAGICU) {
  					segoff += (off_t) exec.a_text;
  					if (overlaid)
  						for (i = 0; i < NOVL; i++)
--- 362,368 ----
  				 * If this is a 0407 style object, the text
  				 * and data are loaded together.
  				 */
! 				if (exec.a_magic != A_MAGIC1) {
  					segoff += (off_t) exec.a_text;
  					if (overlaid)
  						for (i = 0; i < NOVL; i++)
***************
*** 539,545 ****
  
  unsigned
  btoc(nclicks)
! 	unsigned nclicks;
  {
  	return((unsigned)(((((long) nclicks) + ((long) 63)) >> 6)));
  }
--- 559,565 ----
  
  unsigned
  btoc(nclicks)
! 	register unsigned nclicks;
  {
  	return((unsigned)(((((long) nclicks) + ((long) 63)) >> 6)));
  }
*** /usr/src/sys/pdpstand.old/br.c	Fri Aug 26 14:25:30 1988
--- /usr/src/sys/pdpstand/br.c	Sun Apr 21 00:05:45 1991
***************
*** 3,17 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)br.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
!  * br03-like disk driver
!  *  	modified to handle EATON 1537 and 1711 controllers with
!  *	T300, T200, T80 and T50 drives.  NOTE: the boot block is
!  *	hard coded to 32 sec/trk and 19 trk/cyl because he can't
!  *	be made big enough to autosize like this program can.
   */
  
  #include "../h/param.h"
--- 3,15 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)br.c	2.0 (2.11BSD) 4/20/91
   */
  
  /*
!  * rp03-like disk driver
!  *  	modified to handle BR 1537 and 1711 controllers with
!  *	T300, T200, T80 and T50 drives.
   */
  
  #include "../h/param.h"
***************
*** 19,49 ****
  #include "../pdpuba/brreg.h"
  #include "saio.h"
  
! #define BRADDR ((struct brdevice *) 0176710)
! 
  #define	SEC22	02400	/* T200 or T50 */
  #define CYL5	01400	/* T80 or T50 */
  
! int	brsctrk[8], brtrkcyl[8];
  
  brstrategy(io, func)
  	register struct iob *io;
  {
  	int com, cn, tn, sn, unit, sectrk, trkcyl, ctr;
  
  	/* if we haven't gotten the characteristics yet, do so now. */
! 	trkcyl = brtrkcyl[unit = io->i_unit];
! 	if (!(sectrk = brsctrk[unit])) {
! 		/* give a home seek command, then wait for complete */
! 		BRADDR->brcs.w = (unit << 8) | BR_HSEEK | BR_GO;
  		ctr = 0;
! 		while ((BRADDR->brcs.w & BR_RDY) == 0 && --ctr)
  			continue;
! 		if (BRADDR->brcs.w & BR_HE) {
! 			printf("br%d not ready\n", unit);
  			return(-1);
  		}
! 		com = BRADDR->brae;
  		if (com & SEC22)
  			sectrk = 22;
  		else
--- 17,59 ----
  #include "../pdpuba/brreg.h"
  #include "saio.h"
  
! #define	NBR	2
  #define	SEC22	02400	/* T200 or T50 */
  #define CYL5	01400	/* T80 or T50 */
  
! 	struct	brdevice *BRcsr[NBR + 1] =
! 		{
! 		(struct brdevice *)0176710,
! 		(struct brdevice *)0,
! 		(struct brdevice *)-1
! 		};
  
+ int	brsctrk[NBR][8], brtrkcyl[NBR][8];
+ 
  brstrategy(io, func)
  	register struct iob *io;
  {
+ 	register struct brdevice *braddr;
+ 	register int ctlr;
  	int com, cn, tn, sn, unit, sectrk, trkcyl, ctr;
  
+ 	unit = UNITn(io->i_unit);
+ 	ctlr = CTLRn(io->i_unit);
+ 	braddr = BRcsr[ctlr];
+ 
  	/* if we haven't gotten the characteristics yet, do so now. */
! 	trkcyl = brtrkcyl[ctlr][unit];
! 	if (!(sectrk = brsctrk[ctlr][unit])) {
! 		/* give a home seek command, then wait for complete */
! 		braddr->brcs.w = (unit << 8) | BR_HSEEK | BR_GO;
  		ctr = 0;
! 		while ((braddr->brcs.w & BR_RDY) == 0 && --ctr)
  			continue;
! 		if (braddr->brcs.w & BR_HE) {
! 			printf("br%d,%d not ready\n", ctlr,unit);
  			return(-1);
  		}
! 		com = braddr->brae;
  		if (com & SEC22)
  			sectrk = 22;
  		else
***************
*** 52,82 ****
  			trkcyl = 5;
  		else
  			trkcyl = 19;
! 		brsctrk[unit] = sectrk;
! 		brtrkcyl[unit] = trkcyl;
  	}
  	cn = io->i_bn/(sectrk * trkcyl);
  	sn = io->i_bn%(sectrk * trkcyl);
  	tn = sn/sectrk;
  	sn = sn%sectrk;
! 	BRADDR->brcs.w = (unit<<8);
! 	BRADDR->brda = (tn<<8) | sn;
! 	BRADDR->brca = cn;
! 	BRADDR->brba = io->i_ma;
! 	BRADDR->brwc = -(io->i_cc>>1);
! 	BRADDR->brae = segflag;
  	com = (segflag<<4)|BR_GO;
  	if (func == READ)
  		com |= BR_RCOM;
  	else
  		com |= BR_WCOM;
! 	BRADDR->brcs.w |= com;
! 	while ((BRADDR->brcs.w& BR_RDY)==0)
  		continue;
! 	if (BRADDR->brcs.w < 0) {	/* error bit */
! 		printf("disk error: cyl=%d track=%d sect=%d er=%o ds=%o\n",
! 		    cn, tn, sn, BRADDR->brer, BRADDR->brds);
  		return(-1);
  	}
  	return(io->i_cc);
  }
--- 62,98 ----
  			trkcyl = 5;
  		else
  			trkcyl = 19;
! 		brsctrk[ctlr][unit] = sectrk;
! 		brtrkcyl[ctlr][unit] = trkcyl;
  	}
  	cn = io->i_bn/(sectrk * trkcyl);
  	sn = io->i_bn%(sectrk * trkcyl);
  	tn = sn/sectrk;
  	sn = sn%sectrk;
! 	braddr->brcs.w = (unit<<8);
! 	braddr->brda = (tn<<8) | sn;
! 	braddr->brca = cn;
! 	braddr->brba = io->i_ma;
! 	braddr->brwc = -(io->i_cc>>1);
! 	braddr->brae = segflag;
  	com = (segflag<<4)|BR_GO;
  	if (func == READ)
  		com |= BR_RCOM;
  	else
  		com |= BR_WCOM;
! 	braddr->brcs.w |= com;
! 	while ((braddr->brcs.w& BR_RDY)==0)
  		continue;
! 	if (braddr->brcs.w < 0) {	/* error bit */
! 		printf("br%d,%d err: cy=%d tr=%d sc=%d er=%o ds=%o\n",
! 		    ctlr, unit, cn, tn, sn, braddr->brer, braddr->brds);
  		return(-1);
  	}
  	return(io->i_cc);
+ }
+ 
+ bropen(io)
+ 	struct iob *io;
+ {
+ 	return(genopen(NBR, io));
  }
*** /usr/src/sys/pdpstand.old/conf.c	Mon Aug 20 13:53:26 1990
--- /usr/src/sys/pdpstand/conf.c	Tue Apr 23 10:39:58 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)c.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #include "../h/param.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)conf.c	2.0 (2.11BSD) 4/20/91
   */
  
  #include "../h/param.h"
***************
*** 26,32 ****
  devopen(io)
  	register struct iob *io;
  {
! 	(*devsw[io->i_ino.i_dev].dv_open)(io);
  }
  
  devclose(io)
--- 26,32 ----
  devopen(io)
  	register struct iob *io;
  {
! 	return((*devsw[io->i_ino.i_dev].dv_open)(io));
  }
  
  devclose(io)
***************
*** 37,67 ****
  
  nullsys()
  {
  }
  
! int	xpstrategy();
! int	brstrategy();
! int	rkstrategy();
! int	hkstrategy();
! int	rlstrategy();
! int	sistrategy();
! int	rastrategy(), raopen(), raclose();
! int	tmstrategy(), tmrew(), tmopen();
! int	htstrategy(), htopen(), htclose();
! int	tsstrategy(), tsopen(), tsclose();
! int	tmscpstrategy(), tmscpopen(), tmscpclose();
  
  struct devsw devsw[] = {
! 	"xp",	xpstrategy,	nullsys,	nullsys,
! 	"br",	brstrategy,	nullsys,	nullsys,
! 	"rk",	rkstrategy,	nullsys,	nullsys,
! 	"hk",	hkstrategy,	nullsys,	nullsys,
! 	"rl",	rlstrategy,	nullsys,	nullsys,
! 	"si",	sistrategy,	nullsys,	nullsys,
! 	"ra",	rastrategy,	raopen,		raclose,
! 	"tm",	tmstrategy,	tmopen,		tmrew,
! 	"ht",	htstrategy,	htopen,		htclose,
! 	"ts",	tsstrategy,	tsopen,		tsclose,
! 	"tms",  tmscpstrategy,	tmscpopen,	tmscpclose,
  	0,	0,		0,		0,
  };
--- 37,97 ----
  
  nullsys()
  {
+ 	return(-1);
  }
  
! extern	int	xpstrategy(), xpopen();
! extern	int	brstrategy(), bropen();
! extern	int	rkstrategy(), rkopen();
! extern	int	hkstrategy(), hkopen();
! extern	int	rlstrategy(), rlopen();
! extern	int	sistrategy(), siopen();
! extern	int	rastrategy(), raopen(), raclose();
! extern	int	tmstrategy(), tmopen(), tmclose();
! extern	int	htstrategy(), htopen(), htclose();
! extern	int	tsstrategy(), tsopen(), tsclose();
! extern	int	tmscpstrategy(), tmscpopen(), tmscpclose();
  
+ extern	caddr_t	*XPcsr[], *BRcsr[], *RKcsr[], *HKcsr[], *RLcsr[];
+ extern	caddr_t	*SIcsr[], *RAcsr[], *TMcsr[], *HTcsr[], *TScsr[], *TMScsr[];
+ 
+ /*
+  * NOTE!  This table must be in major device number order.  See /sys/pdp/conf.c
+  *	  for the major device numbers.
+ */
+ 
  struct devsw devsw[] = {
! 	"ht",	htstrategy,	htopen,		htclose,	HTcsr, /* 0 */
! 	"tm",	tmstrategy,	tmopen,		tmclose,	TMcsr, /* 1 */
! 	"ts",	tsstrategy,	tsopen,		tsclose,	TScsr, /* 2 */
! 	"ram",	nullsys,	nullsys,	nullsys,	0,     /* 3 */
! 	"hk",	hkstrategy,	hkopen,		nullsys,	HKcsr, /* 4 */
! 	"ra",	rastrategy,	raopen,		raclose,	RAcsr, /* 5 */
! 	"rk",	rkstrategy,	rkopen,		nullsys,	RKcsr, /* 6 */
! 	"rl",	rlstrategy,	rlopen,		nullsys,	RLcsr, /* 7 */
! 	"rx",	nullsys,	nullsys,	nullsys,	0,     /* 8 */
! 	"si",	sistrategy,	siopen,		nullsys,	SIcsr, /* 9 */
! 	"xp",	xpstrategy,	xpopen,		nullsys,	XPcsr, /* 10 */
! 	"br",	brstrategy,	bropen,		nullsys,	BRcsr, /* 11 */
! 	"tms",  tmscpstrategy,	tmscpopen,	tmscpclose,	TMScsr,/* 12 */
  	0,	0,		0,		0,
  };
+ 
+ 	int	ndevsw = (sizeof (devsw) / sizeof (devsw[0])) - 1;
+ 
+ 	char	ADJcsr[] =
+ 		{
+ 		0,	/* HT = 0 */
+ 		2,	/* TM = 1 */
+ 		2,	/* TS = 2 */
+ 		0,	/* RAM = 3 */
+ 		0,	/* HK = 4 */
+ 		0,	/* RA = 5 */
+ 		4,	/* RK = 6 */
+ 		0,	/* RL = 7 */
+ 		0,	/* RX = 8 */
+ 		0,	/* XP/SI = 9 */
+ 		0,	/* XP = 10 */
+ 		4,	/* BR =11 */
+ 		0,	/* TMS = 12 */
+ 		};
*** /usr/src/sys/pdpstand.old/hk.c	Fri Aug 19 11:52:23 1988
--- /usr/src/sys/pdpstand/hk.c	Sun Apr 21 00:06:35 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)hk.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.
   *
!  *	@(#)hk.c	2.0 (2.11BSD) 4/20/91
   */
  
  /*
***************
*** 15,63 ****
  #include "../pdpuba/hkreg.h"
  #include "saio.h"
  
! 
! #define	HKADDR	((struct hkdevice *)0177440)
! 
! #define	NHK	8
  #define	NSECT	22
  #define	NTRAC	3
  
! int hk_drvtyp[NHK];
! char hk_mntflg[NHK];
  
  
  hkstrategy(io, func)
  	register struct iob *io;
  {
  	register unit, com;
! 	register i;
  	daddr_t bn;
! 	int sn, cn, tn;
  
! 	unit = io->i_unit;
! 	if (hk_mntflg[unit] != '1') {
! 		hk_drvtyp[unit] = 0;
! 		HKADDR->hkcs2 = unit;
! 		HKADDR->hkcs1 = HK_SELECT|HK_GO;
! 		while ((HKADDR->hkcs1 & HK_CRDY) == 0)
  			continue;
! 		if (HKADDR->hkcs1 & HK_CERR && HKADDR->hker & HKER_DTYE) {
! 			hk_drvtyp[unit] = 02000;
  		}
! 		hk_mntflg[unit] = '1';
  	}
  	bn = io->i_bn;
! 	HKADDR->hkcs2 = HKCS2_SCLR;
! 	while ((HKADDR->hkcs1 & HK_CRDY) == 0)
  		continue;
! 	HKADDR->hkcs2 = unit;
! 	HKADDR->hkcs1 = hk_drvtyp[unit]|HK_SELECT|HK_GO;
! 	while ((HKADDR->hkcs1 & HK_CRDY) == 0)
  		continue;
  
! 	if ((HKADDR->hkds & HKDS_VV) == 0) {
! 		HKADDR->hkcs1 = hk_drvtyp[unit]|HK_PACK|HK_GO;
! 		while ((HKADDR->hkcs1 & HK_CRDY) == 0)
  			continue;
  	}
  	cn = bn/(NSECT*NTRAC);
--- 15,68 ----
  #include "../pdpuba/hkreg.h"
  #include "saio.h"
  
! #define	NHK	2
  #define	NSECT	22
  #define	NTRAC	3
  
! 	struct	hkdevice *HKcsr[NHK + 1] =
! 		{
! 		(struct hkdevice *)0177440,
! 		(struct hkdevice *)0,
! 		(struct hkdevice *)-1
! 		};
  
+ int hk_drvtyp[NHK][8];
+ char hk_mntflg[NHK][8];
  
  hkstrategy(io, func)
  	register struct iob *io;
  {
  	register unit, com;
! 	register struct hkdevice *hkaddr;
  	daddr_t bn;
! 	int sn, cn, tn, ctlr;
  
! 	unit = UNITn(io->i_unit);
! 	ctlr = CTLRn(io->i_unit);
! 	hkaddr = HKcsr[ctlr];
! 	if (hk_mntflg[ctlr][unit] != '1') {
! 		hk_drvtyp[ctlr][unit] = 0;
! 		hkaddr->hkcs2 = unit;
! 		hkaddr->hkcs1 = HK_SELECT|HK_GO;
! 		while ((hkaddr->hkcs1 & HK_CRDY) == 0)
  			continue;
! 		if (hkaddr->hkcs1 & HK_CERR && hkaddr->hker & HKER_DTYE) {
! 			hk_drvtyp[ctlr][unit] = 02000;
  		}
! 		hk_mntflg[ctlr][unit] = '1';
  	}
  	bn = io->i_bn;
! 	hkaddr->hkcs2 = HKCS2_SCLR;
! 	while ((hkaddr->hkcs1 & HK_CRDY) == 0)
  		continue;
! 	hkaddr->hkcs2 = unit;
! 	hkaddr->hkcs1 = hk_drvtyp[ctlr][unit]|HK_SELECT|HK_GO;
! 	while ((hkaddr->hkcs1 & HK_CRDY) == 0)
  		continue;
  
! 	if ((hkaddr->hkds & HKDS_VV) == 0) {
! 		hkaddr->hkcs1 = hk_drvtyp[ctlr][unit]|HK_PACK|HK_GO;
! 		while ((hkaddr->hkcs1 & HK_CRDY) == 0)
  			continue;
  	}
  	cn = bn/(NSECT*NTRAC);
***************
*** 65,88 ****
  	tn = sn/NSECT;
  	sn = sn%NSECT;
  
! 	HKADDR->hkcyl = cn;
! 	HKADDR->hkda = (tn<<8) | sn;
! 	HKADDR->hkba = io->i_ma;
! 	HKADDR->hkwc = -(io->i_cc>>1);
! 	com = hk_drvtyp[unit]|(segflag << 8) | HK_GO;
  	if (func == READ)
  		com |= HK_READ;
  	else if (func == WRITE)
  		com |= HK_WRITE;
! 	HKADDR->hkcs1 = com;
  
! 	while ((HKADDR->hkcs1 & HK_CRDY) == 0)
  		continue;
  
! 	if (HKADDR->hkcs1 & HK_CERR) {
! 		printf("disk error: cyl=%d track=%d sect=%d cs2=%d err=%o\n",
! 			cn, tn, sn, HKADDR->hkcs2, HKADDR->hker);
  		return(-1);
  	}
  	return(io->i_cc);
  }
--- 70,99 ----
  	tn = sn/NSECT;
  	sn = sn%NSECT;
  
! 	hkaddr->hkcyl = cn;
! 	hkaddr->hkda = (tn<<8) | sn;
! 	hkaddr->hkba = io->i_ma;
! 	hkaddr->hkwc = -(io->i_cc>>1);
! 	com = hk_drvtyp[ctlr][unit]|(segflag << 8) | HK_GO;
  	if (func == READ)
  		com |= HK_READ;
  	else if (func == WRITE)
  		com |= HK_WRITE;
! 	hkaddr->hkcs1 = com;
  
! 	while ((hkaddr->hkcs1 & HK_CRDY) == 0)
  		continue;
  
! 	if (hkaddr->hkcs1 & HK_CERR) {
! 		printf("hk%d,%d err: cy=%d tr=%d sc=%d cs2=%d er=%o\n",
! 			ctlr, unit, cn, tn, sn, hkaddr->hkcs2, hkaddr->hker);
  		return(-1);
  	}
  	return(io->i_cc);
+ }
+ 
+ hkopen(io)
+ 	struct iob *io;
+ {
+ 	return(genopen(NHK, io));
  }
*** /usr/src/sys/pdpstand.old/ht.c	Fri Aug 19 11:53:51 1988
--- /usr/src/sys/pdpstand/ht.c	Sun Apr 21 00:07:30 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ht.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.
   *
!  *	@(#)ht.c	2.0 (2.11BSD) 4/20/91
   */
  
  /*
***************
*** 15,27 ****
  #include "../pdpuba/htreg.h"
  #include "saio.h"
  
! 
! #define	HTADDR	((struct htdevice *)0172440)
! 
! #define	TUUNIT(dev)	(minor(dev) & 03)
  #define	H_NOREWIND	004		/* not used in stand alone driver */
  #define	H_1600BPI	010
  
  extern int tapemark;	/* flag to indicate tapemark encountered
  			   (see sys.c as to how it's used) */
  
--- 15,30 ----
  #include "../pdpuba/htreg.h"
  #include "saio.h"
  
! #define	NHT		2
  #define	H_NOREWIND	004		/* not used in stand alone driver */
  #define	H_1600BPI	010
  
+ 	struct	htdevice *HTcsr[NHT + 1] =
+ 		{
+ 		(struct htdevice *)0172440,
+ 		(struct htdevice *)0,
+ 		(struct htdevice *)-1
+ 		};
  extern int tapemark;	/* flag to indicate tapemark encountered
  			   (see sys.c as to how it's used) */
  
***************
*** 29,36 ****
--- 32,42 ----
  	register struct iob *io;
  {
  	register skip;
+ 	register int ctlr = CTLRn(io->i_unit);
  	int i;
  
+ 	if (genopen(NHT, io) < 0)
+ 		return(-1);
  	htstrategy(io, HT_REW);
  	skip = io->i_boff;
  	while (skip--) {
***************
*** 42,47 ****
--- 48,54 ----
  			continue;
  		htstrategy(io, HT_SENSE);
  	}
+ 	return(0);
  }
  
  htclose(io)
***************
*** 53,71 ****
  htstrategy(io, func)
  	register struct iob *io;
  {
! 	register unit, com, errcnt;
  
! 	unit = io->i_unit;
  	errcnt = 0;
  retry:
! 	htquiet();
  
! 	HTADDR->httc =
! 		((unit&H_1600BPI) ? HTTC_1600BPI : HTTC_800BPI)
! 		| HTTC_PDP11 | TUUNIT(unit);
! 	HTADDR->htba = io->i_ma;
! 	HTADDR->htfc = -io->i_cc;
! 	HTADDR->htwc = -(io->i_cc >> 1);
  	com = ((segflag) << 8) | HT_GO;
  	if (func == READ)
  		com |= HT_RCOM;
--- 60,85 ----
  htstrategy(io, func)
  	register struct iob *io;
  {
! 	register unit, com;
! 	int errcnt, ctlr;
! 	register struct htdevice *htaddr;
  
! 	unit = UNITn(io->i_unit);
! 	ctlr = CTLRn(io->i_unit);
! 	htaddr = HTcsr[ctlr];
  	errcnt = 0;
  retry:
! 	while ((htaddr->htcs1 & HT_RDY) == 0)
! 		continue;
! 	while (htaddr->htfs & HTFS_PIP)
! 		continue;
  
! 	htaddr->httc =
! 		((io->i_unit&H_1600BPI) ? HTTC_1600BPI : HTTC_800BPI)
! 		| HTTC_PDP11 | unit;
! 	htaddr->htba = io->i_ma;
! 	htaddr->htfc = -io->i_cc;
! 	htaddr->htwc = -(io->i_cc >> 1);
  	com = ((segflag) << 8) | HT_GO;
  	if (func == READ)
  		com |= HT_RCOM;
***************
*** 72,95 ****
  	else if (func == WRITE)
  		com |= HT_WCOM;
  	else if (func == HT_SREV) {
! 		HTADDR->htfc = -1;
! 		HTADDR->htcs1 = com | HT_SREV;
  		return(0);
  	} else
  		com |= func;
! 	HTADDR->htcs1 = com;
! 	while ((HTADDR->htcs1 & HT_RDY) == 0)
  		continue;
! 	if (HTADDR->htfs & HTFS_TM) {
  		tapemark = 1;
! 		htinit();
  		return(0);
  	}
! 	if (HTADDR->htcs1 & HT_TRE) {
  		if (errcnt == 0)
! 			printf("\nHT unit %d tape error: cs2=%o, er=%o",
! 			    unit, HTADDR->htcs2, HTADDR->hter);
! 		htinit();
  		if (errcnt++ == 10) {
  			printf("\n(FATAL ERROR)\n");
  			return(-1);
--- 86,109 ----
  	else if (func == WRITE)
  		com |= HT_WCOM;
  	else if (func == HT_SREV) {
! 		htaddr->htfc = -1;
! 		htaddr->htcs1 = com | HT_SREV;
  		return(0);
  	} else
  		com |= func;
! 	htaddr->htcs1 = com;
! 	while ((htaddr->htcs1 & HT_RDY) == 0)
  		continue;
! 	if (htaddr->htfs & HTFS_TM) {
  		tapemark = 1;
! 		htinit(htaddr);
  		return(0);
  	}
! 	if (htaddr->htcs1 & HT_TRE) {
  		if (errcnt == 0)
! 			printf("\nHT%d,%d err: cs2=%o, er=%o",
! 			    ctlr, unit, htaddr->htcs2, htaddr->hter);
! 		htinit(htaddr);
  		if (errcnt++ == 10) {
  			printf("\n(FATAL ERROR)\n");
  			return(-1);
***************
*** 97,124 ****
  		htstrategy(io, HT_SREV);
  		goto retry;
  	}
! 	if (errcnt)
! 		printf("\n(RECOVERED by retry)\n");
! 	return(io->i_cc+HTADDR->htfc);
  }
  
! htinit()
  {
  	register int omt, ocs2;
  
! 	omt = HTADDR->httc & 03777;
! 	ocs2 = HTADDR->htcs2 & 07;
  
! 	HTADDR->htcs2 = HTCS2_CLR;
! 	HTADDR->htcs2 = ocs2;
! 	HTADDR->httc = omt;
! 	HTADDR->htcs1 = HT_DCLR|HT_GO;
! }
! 
! htquiet()
! {
! 	while ((HTADDR->htcs1 & HT_RDY) == 0)
! 		continue;
! 	while (HTADDR->htfs & HTFS_PIP)
! 		continue;
  }
--- 111,129 ----
  		htstrategy(io, HT_SREV);
  		goto retry;
  	}
! 	return(io->i_cc+htaddr->htfc);
  }
  
! htinit(htaddr)
! 	register struct htdevice *htaddr;
  {
  	register int omt, ocs2;
  
! 	omt = htaddr->httc & 03777;
! 	ocs2 = htaddr->htcs2 & 07;
  
! 	htaddr->htcs2 = HTCS2_CLR;
! 	htaddr->htcs2 = ocs2;
! 	htaddr->httc = omt;
! 	htaddr->htcs1 = HT_DCLR|HT_GO;
  }
*** /usr/src/sys/pdpstand.old/maketape.c	Wed Dec 19 10:18:27 1990
--- /usr/src/sys/pdpstand/maketape.c	Sun Apr 28 22:56:06 1991
***************
*** 4,10 ****
   * specifies the terms and conditions for redistribution.
   *
   *	@(#)maketape.c	1.1 (2.10BSD Berkeley) 12/1/86
!  *			    (2.11BSD Contel) 10/1/90
   *		TU81s didn't like open/close/write at 1600bpi, use
   *		ioctl to write tape marks instead.
   */
--- 4,10 ----
   * specifies the terms and conditions for redistribution.
   *
   *	@(#)maketape.c	1.1 (2.10BSD Berkeley) 12/1/86
!  *			    (2.11BSD Contel) 4/20/91
   *		TU81s didn't like open/close/write at 1600bpi, use
   *		ioctl to write tape marks instead.
   */
***************
*** 30,36 ****
  	int argc;
  	char *argv[];
  {
! 	int i, j = 0, k = 0;
  	FILE *mf;
  
  	if (argc != 3) {
--- 30,36 ----
  	int argc;
  	char *argv[];
  {
! 	register int i, j = 0, k = 0;
  	FILE *mf;
  
  	if (argc != 3) {
***************
*** 91,96 ****
--- 91,97 ----
  			}
  		}
  		if (cnt>0) {
+ 			j++;
  			bzero(buf + cnt, recsz - cnt);
  			if (write(mt, buf, recsz) < 0) {
  				perror(argv[1]);
*** /usr/src/sys/pdpstand.old/mtboot.s	Fri Sep  2 21:02:25 1988
--- /usr/src/sys/pdpstand/mtboot.s	Fri May  3 23:55:21 1991
***************
*** 1,39 ****
  /*
   * Primary tape boot program to load and execute secondary boot.
   *
!  * Two copies of the primary boot are stored in the first and second blocks
!  * of the first tape file (some boot proms execute the second block when
   * booting a tape).  The secondary boot is also stored in the first tape
!  * file, starting at block #3.
   *
-  * Note that this boot has been hacked to death in order to squeeze three
-  * primary tape boots in for the HT, TM, and TS.  It turns out that this
-  * wasn't as hard as one might think since the original primary tape boots
-  * were overly ambitious in their generality.  Needless to say, that
-  * generality is no longer present ...
-  *
-  * Note that while we are prepared to compile multiple different primary
-  * bootstraps to support different tape densities (BPI), we don't bother
-  * ifdef'ing out the various drivers which don't support the defined
-  * BPI.  They all fit in 512 bytes now, so who cares?
-  *
   * Also note that the struct exec header must be removed from this bootstrap.
!  * This needs to be done so taking the addresses of the various tape rewind
!  * and read functions will work.
   */
  NEWLOC	= [48.*1024.]			/ we relocate ourselves to this address
  
! #ifndef BPI
! #	define	BPI	1600
! #endif
  
- busvec	= 04				/ bus error trap vector
- hipri	= 0340				/ PS slp 7
- 
  a_text	= 02				/ a_text (struct exec) field offset
  a_data	= 04				/ a_data (struct exec) field offset
  
! trew	= r5				/ pointer at trew routine
  tread	= r4				/ pointer at tread routine
  blkcnt	= r3				/ number of blocks to read
  memaddr	= r2				/ memory location to read into
--- 1,35 ----
  /*
   * Primary tape boot program to load and execute secondary boot.
   *
!  * This is a universal tape boot which can handle HT, TM, TS and TMSCP
!  * tapes.  This boot is FULL.  Some of the more extended error
!  * checking had to be left out to get all the drivers to fit.
!  *
!  * Two copies of the primary boot are stored in the first and second records
!  * of the first tape file (some boot proms execute the second one when
   * booting a tape).  The secondary boot is also stored in the first tape
!  * file, starting at record #3.
   *
   * Also note that the struct exec header must be removed from this bootstrap.
!  * This needs to be done so taking the address of the tape read and rewind
!  * functions will work.
!  *
!  * Due to size constraints and the rather destructive way in which
!  * all the registers are used, this boot does not support the 
!  * "jsr pc,0; br restart" convention.
   */
  NEWLOC	= [48.*1024.]			/ we relocate ourselves to this address
+ OURSIZE = 512.				/ assume we are up to this size
  
! HT_MAJOR = 0				/ major device number from bdevsw[]
! TM_MAJOR = 1
! TS_MAJOR = 2
! TMS_MAJOR = 12.
  
  a_text	= 02				/ a_text (struct exec) field offset
  a_data	= 04				/ a_data (struct exec) field offset
  
! csr	= r5				/ saved csr of boot device
  tread	= r4				/ pointer at tread routine
  blkcnt	= r3				/ number of blocks to read
  memaddr	= r2				/ memory location to read into
***************
*** 45,86 ****
  	br	1f			/ "   "    "     "
  1:
  	mov	$NEWLOC,sp		/ give ourselves a stack to work with
! 	cmp	pc,sp			/ are we running above the stack?
! 	bhis	3f			/ [yes, no need to relocate ourselves]
! 	mov	sp,r1			/ no, we gotta move ourselves up
! 	clr	r0			/ [assume we're at location 0 now]
! 	mov	$256.,r2		/ primary boot is at most 256 words
  2:
! 	mov	(r0)+,(r1)+		/ move primary boot to just above
! 	sob	r2,2b			/   the stack
! 	jmp	(sp)			/ reexecute ourselves at our new loc
  3:
! 	mov	$hipri,*$busvec+2	/ take bus errors at high priority
! httest:
! 	mov	$1f,*$busvec+0		/ HT htcs1 register present?
! 	tst	*$htcs1			/   yes, if we got here: set trew and
! 	mov	$htrew,trew		/   tread routines and continue
! 	mov	$htread,tread
! 	br	readit
! 1:
! tmtest:
! 	mov	$1f,*$busvec+0		/ TM tmmr register present? (the TM
! 	tst	*$tmmr			/   TS controllers use the same CSR
! 	mov	$tmread,tread		/   address, but tmmr is above the
! 	mov	$tmrew,trew		/   last CSR address of the TS ...)
! 	br	readit
! 1:
! tstest:
! 	mov	$tsread,tread		/ else it has to be a TS ...
! 	mov	$tsrew,trew
  readit:
! 	jsr	pc,*trew		/ rewind the tape
! 	mov	$2,blkcnt		/ skip past the two copies of our
! 	clr	memaddr			/   self on the tape (throw them
! 	jsr	pc,*tread		/   at location zero)
! 	mov	$1,blkcnt		/ and read the first block
! 	clr	memaddr			/   to location 0 ...
! 	jsr	pc,*tread
  
  	mov	*$a_text,blkcnt		/ compute remaining amount to read:
  	add	*$a_data,blkcnt		/   (a_text + a_data
--- 41,88 ----
  	br	1f			/ "   "    "     "
  1:
  	mov	$NEWLOC,sp		/ give ourselves a stack to work with
! 	clr	r4
! 	mov	sp,r5
! 	mov	$OURSIZE\/2,r3		/ primary boot size in words
  2:
! 	clr	OURSIZE(r5)		/ clear work area (major & TS/MSCP area)
! 	mov	(r4)+,(r5)+		/ move primary boot to just above
! 	sob	r3,2b			/   the stack
! 	jmp	*$3f			/ bypass the relocation code
  3:
! 	mov	r0,unit			/ save unit number
! 	mov	r1,csr			/ save the csr
! 	cmp	r1,$172440		/ HT is always at this address
! 	beq	common			/ r3 is table index
! 	inc	r3			/ index for TMSCP
! 	cmp	r1,$172522		/ is this a TS?
! 	blo	common			/ no - br, likely TMSCP
! 	cmp	r1,$172522+[7*4]	/ is CSR in the TS range?
! 	bhi	common			/ no, is a TMSCP - br
! 	inc	r3			/ adjust index to TS
! 	mov	(r1),r4			/ save contents of csr in case of a TM
! 	clr	(r1)			/ poke the controller
! /	clr	r2			/ now we delay
! /1:
! /	sob	r2,1b			/ time for TS to run diagnostics
! 2:
! 	tstb	(r1)			/ is controller ready?
! 	bpl	2b			/ no - br
! 	bit	$2000,(r1)		/ TS "address required" bit
! 	bne	common			/ if a TS - br
! 	mov	r4,(r1)			/ is a TM, restore unit/density select
! 	inc	r3			/ make TM index
! common:
! 	movb	table1(r3),major+1	/ save major device number to high byte
! 	asl	r3			/ make a word index
! 	mov	table2(r3),tread	/ fetch read routine address
! 	jsr	pc,*table3(r3)		/ call rewind routine (must preserve r4)
  readit:
! 	clr	memaddr			/ load starting at 0
! 	jsr	pc,*tread		/ skip the two copies of this
! 	jsr	pc,*tread		/ program on the tape
! 	clr	memaddr			/ reset memory address
! 	jsr	pc,*tread		/ read first block of boot
  
  	mov	*$a_text,blkcnt		/ compute remaining amount to read:
  	add	*$a_data,blkcnt		/   (a_text + a_data
***************
*** 88,247 ****
  	ash	$-9.,blkcnt		/    - 512) [already read one block]
  	bic	$177600,blkcnt		/   / 512 [[unsigned]]
  	beq	done			/ already done if == 0 [not likely]
! 
  	jsr	pc,*tread
  done:
- 	clr	r0			/ strip the a.out header from the
- 	mov	$16.,r1			/   secondary boot by shifting it
  1:					/   down by sizeof(struct exec)
! 	mov	(r1)+,(r0)+
! 	cmp	r1,sp
  	blo	1b
! 	clr	pc			/ jump to location 0 ...
  
  /*
!  *			HT tape driver
   */
! htcs1	= 0172440
! htba	= 0172444
! htfc	= 0172446
! htcs2	= 0172450
! htds	= 0172452
! httc	= 0172472
  
- PIP	= 020000
  RESET	= 040
- MOL	= 010000
- ERR	= 040000
- REV	= 033
  READ	= 071
  REW	= 07
  
- #if BPI == 800
- 	HTBPI	= 01700			/ 800BPI | PDP-11 mode
- #endif
- #if BPI == 1600
- 	HTBPI	= 02300			/ 1600BPI | PDP-11 mode
- #endif
- #if BPI == 6250
- 	HTBPI	= 0			/ just so things assemble right
- #endif
- 
- /*
-  * Read blkcnt tape records into location memaddr.
-  * Side effects:
-  *	blkcnt gets zeroed
-  *	memaddr += 512 * blkcnt
-  *	tape is advanced blkcnt records
-  */
- htread:
- 	jsr	pc,hrrec		/ read tape records until blkcnt
- 	sob	blkcnt,htread		/   goes to 0 ...
- 	rts	pc
- 
- /*
-  * Read one tape record.
-  * Side effects:
-  *	memaddr += 512
-  *	tape is advanced 1 record
-  */
  hrrec:
! 	mov	$htds,r0
! 	tstb	(r0)
! 	bpl	hrrec
! 	bit	$PIP,(r0)
! 	bne	hrrec
! 	bit	$MOL,(r0)
! 	beq	hrrec
! 	mov	$htfc,r0
! 	mov	$-512.,(r0)
! 	mov	memaddr,-(r0)
! 	mov	$-256.,-(r0)
! 	mov	$READ,-(r0)
! 1:
! 	tstb	(r0)
! 	bpl	1b
! 	bit	$ERR,(r0)
! 	bpl	2f
! 	mov	$RESET,*$htcs2
! 	mov	$-1,*$htfc
! 	mov	$REV,(r0)
! 	br	hrrec
! 2:
! 	add	$512.,memaddr
! 	rts	pc
  
  /*
!  * Rewind tape.
!  * Side effects:
!  *	just what the first line says ...
   */
  htrew:
! 	mov	$RESET,*$htcs2
! 	mov	$HTBPI,*$httc
! 	mov	$REW,*$htcs1
! 	rts	pc
  
- 
  /*
!  *			TM tape driver
   */
! tmer	= 172520
! tmcs	= 172522
! tmbc	= 172524
! tmba	= 172526
! tmdb	= 172530
! tmrd	= 172532
! tmmr	= 172534
  
- #if BPI == 800
- 	TMBPI	= 060000
- #endif
- #if BPI == 1600
- 	TMBPI	= 000000		/ Third party TMs only
- #endif
- #if BPI == 6250
- 	TMBPI	= 020000		/ Third party TMs only
- #endif
- 
- /*
-  * Read blkcnt tape records into location memaddr.
-  * Side effects:
-  *	blkcnt gets zeroed
-  *	memaddr += 512 * blkcnt
-  *	tape is advanced blkcnt records
-  */
- tmread:
- 	jsr	pc,tmrrec		/ read tape records until blkcnt
- 	sob	blkcnt,tmread		/   goes to 0 ...
- 	rts	pc
- 
- /*
-  * Read one tape record.
-  * Side effects:
-  *	memaddr += 512
-  *	tape is advanced 1 record
-  */
  tmrrec:
! 	mov	$tmer,r0
! 	bit	$2,(r0)+		/ rewind status
! 	bne	tmrrec
! 	tstb	(r0)+			/ cu ready
! 	bpl	tmrrec
! 	inc 	r0
! 	mov	$-512.,(r0)+		/ byte count
! 	mov	memaddr,(r0)		/ bus address
! 	mov	$tmcs,r0
! 	mov	$TMBPI|3,(r0)		/ read
! 1:
! 	tstb	(r0)
! 	bpl	1b
! 	tst	(r0)+
! 	bpl	2f
! 	mov	$-1,(r0)
! 	mov	$TMBPI|13,-(r0)		/ backspace
! 	br	tmrrec
! 2:
  	add	$512.,memaddr
  	rts	pc
  
--- 90,187 ----
  	ash	$-9.,blkcnt		/    - 512) [already read one block]
  	bic	$177600,blkcnt		/   / 512 [[unsigned]]
  	beq	done			/ already done if == 0 [not likely]
! 2:
  	jsr	pc,*tread
+ 	sob	blkcnt,2b
  done:
  1:					/   down by sizeof(struct exec)
! 	mov	20(blkcnt),(blkcnt)+	/ r3 cleared by loop above
! 	cmp	blkcnt,sp
  	blo	1b
! 	mov	csr,r1			/ put things where 'boot'
! 	mov	unit,r3			/  expects them
! 	bis	major,r3		/ the major device to high byte
! 	clr	pc			/ go to location 0 ... no return
  
  /*
!  *	HT tape driver
   */
! htcs1	= 0				/ offset from base csr
! htwc	= 2
! htba	= 4
! htfc	= 6
! htcs2	= 10
! htds	= 12
! hter	= 14
! httc	= 32
  
  RESET	= 040
  READ	= 071
  REW	= 07
  
  hrrec:
! 	mov	memaddr,htba(csr)
! 	mov	$-256.,htwc(csr)
! 	mov	$READ,(csr)		/ htcs1
! htcmd:
! 	tstb	(csr)			/ controller ready?
! 	bpl	htcmd
! 	tst	htds(csr)		/ drive ready?
! 	bpl	htcmd
! 	tstb	htcs2+1(csr)		/ any controller errors?
! 	bne	ctlerr
! 	bit	$!1000,hter(csr)	/ any drive errors except HTER_FCE?
! 	beq	bumpaddr		/ no, go bump address
! ctlerr:
! 	halt
  
  /*
!  * Rewind tape.  This routine is only done once and must preceed any reads.
   */
  htrew:
! 	tstb	(csr)			/ controller ready?
! 	bpl	htrew			/ no - go try again
! 	mov	htcs2(csr),r1		/ boot unit(formatter) number
! 	bic	$!7,r1			/ only the low bits
! 	mov	httc(csr),r0		/ save format,slave,density
! 	bic	$!3767,r0		/ only the bits we're interested in
! 	mov	$RESET,htcs2(csr)	/ reset controller
! 	movb	r1,htcs2(csr)		/ reselect boot unit(formatter)
! 	mov	r0,httc(csr)		/ reselect density/format/slave(drive)
! 	mov	$REW,(csr)
! 	br	htcmd			/ join common code
  
  /*
!  *	TM tape driver
   */
! tmer	= -2				/ offset from base csr
! tmcs	= 0
! tmbc	= 2
! tmba	= 4
! tmdb	= 6
! tmrd	= 10
! tmmr	= 12
  
  tmrrec:
! 	mov	$-512.,tmbc(csr)	/ bytecount
! 	mov	memaddr,tmba(csr)	/ bus address
! 	mov	$3,r1			/ 'read'
! tmcmd:
! 	mov	(csr),r0
! 	bic	$!63400,r0		/ save the density and unit
! 	bis	r1,r0			/ merge in the function code
! 	mov	r0,(csr)		/ tmcs - give command
! /1:
! /	bit	$100,tmer(csr)		/ unit still selected? (TMER_SELR)
! /	beq	ctlerr			/ nope, go halt
! /	bit	$1,tmer(csr)		/ unit ready? (TMER_TUR)
! /	beq	1b			/ no, keep waiting
! tmtscom:
! 	bit	$100200,(csr)		/ error or ready?
! 	beq	tmtscom			/ neither, keep looking
! 	bmi	ctlerr			/ error - go halt
! 
! bumpaddr:
  	add	$512.,memaddr
  	rts	pc
  
***************
*** 251,337 ****
   *	just what the first line says ...
   */
  tmrew:
! 	mov	$TMBPI|17,*$tmcs
! 	rts	pc
  
- 
  /*
!  *			TS tape driver
!  *
   */
! tsdb = 172520
! tssr  = 172522
  
- TSINIT = 140013
  TSCHAR = 140004
  TSREW  = 102010
  TSREAD = 100001
- TSRETRY = 100401
  
- tsdbuf = NEWLOC + 512.			/ put ts data buffer just after us
- 
- /*
-  * Read blkcnt tape records into location memaddr.
-  * Side effects:
-  *	blkcnt gets zeroed
-  *	memaddr += 512 * blkcnt
-  *	tape is advanced blkcnt records
-  */
- tsread:
- 	jsr	pc,tsrrec		/ read tape records until blkcnt
- 	sob	blkcnt,tsread		/   goes to 0 ...
- 	rts	pc
- 
- /*
-  * Read one tape record.
-  * Side effects:
-  *	memaddr += 512
-  *	tape is advanced 1 record
-  */
  tsrrec:
- 	tstb	tssr
- 	bpl	tsrrec
  	mov	$tsdbuf+6,r0
  	mov	$512.,(r0)
  	clr	-(r0)
  	mov	memaddr,-(r0)
  	mov	$TSREAD,-(r0)
! 	mov	r0,tsdb
! 1:
! 	tstb	tssr
! 	bpl	1b
! 	cmp	$1,tssr
! 	blos	2f
! 	mov	$TSRETRY,(r0)
! 	mov	r0,tsdb
! 	br	1b
! 2:
! 	add	$512.,memaddr
! 	rts	pc
  
  /*
!  * Rewind tape.
   * Side effects:
   *	just what the first line says ...
   */
  tsrew:
! 	tstb	tssr			/ initialize ...
! 	bpl	tsrew
! 	mov	$tsdbuf,r0
! 	mov	$TSCHAR,(r0)+
! 	mov	$tsdbuf+10,(r0)+
! 	clr	(r0)+
! 	mov	$10,(r0)+
! 	mov	r0,(r0)+
! 	clr	(r0)+
! 	mov	$16,(r0)+
! 	mov	$tsdbuf,tsdb
! 1:
! 	tstb	tssr
! 	bpl	1b
  /*
!  * rewind
!  */
! 	mov	$TSREW,tsdbuf
! 	mov	$tsdbuf,tsdb
  	rts	pc
--- 191,352 ----
   *	just what the first line says ...
   */
  tmrew:
! 	mov	$17,r1			/ 'rewind'
! 	br	tmcmd			/ join common code
  
  /*
!  *	TS tape driver
   */
! tsdb = -2				/ offset from ROM supplied address
! tssr = 0
  
  TSCHAR = 140004
  TSREW  = 102010
  TSREAD = 100001
  
  tsrrec:
  	mov	$tsdbuf+6,r0
  	mov	$512.,(r0)
  	clr	-(r0)
  	mov	memaddr,-(r0)
  	mov	$TSREAD,-(r0)
! 	mov	r0,tsdb(csr)
! 	br	tmtscom
  
  /*
!  * Rewind and initialize tape - only done once.
   * Side effects:
   *	just what the first line says ...
   */
  tsrew:
! 	mov	$tsdbuf,tsdb(csr)
! 	br	tmtscom			/ go join common code
! 
! .if [.-start]&2
! 	.blkb	2			/ tsdbuf must be on a mod 4 boundary
! .endif
! tsdbuf:
! 	TSCHAR				/ command
! 	tsdbuf+10			/ buffer address (lo)
! 	0				/ buffer address (hi - always 0)
! 	10				/ length of command buffer
! 
! / from here on is used only at initialization/rewind time.  The Set
! / Charactistics command only looks at the word following the buffer length,
! / part of the TMSCP code is used as the remainder of the characteristics packet.
! 
! 	tsdbuf+10			/ buffer address (lo)
! 	0				/ buffer address (hi - always 0)
! 	16				/ minimum length packet
! 	0				/ characteristics to set (lo byte)
! 
  /*
!  * Copyright (c) Digital Equipment Corporation 1984, 1985, 1986.
!  * All Rights Reserved.
!  * Reference "/usr/src/COPYRIGHT" for applicable restrictions.
!  *
!  * ULTRIX-11 Block Zero Bootstrap for TMSCP Magtape
!  *
!  * SCCSID: @(#)tkboot.s	3.0	4/21/86
!  *
!  * Chung_wu Lee		2/8/85
!  *
!  * sms 4/27/91 - merged into universal tape boot
!  * sms 4/12/91 - saved some more space.  the major device number and unit
!  *	number are now passed to the secondary boot along with the csr of
!  *	the booting controller.
!  *
!  * Steven M. Schultz (sms@wlv.imsd.contel.com) Aug 20 1990.  Port to 2.11BSD
! */
! 
! s1	= 4000
! go	= 1
! 
! / TK initialization (and rewind) - only done once
! tkrew:
! 	clr	(csr)+		/ start tk init sequence
! 				/ move pointer to tksa register
! 	mov	$s1,r0		/ set tk state test bit to step 1
! 	mov	$cmdtbl,r1	/ address of init seq table
! 2:
! 	tst	(csr)		/ error ?
! 	bmi	.		/ yes, hang - can't restart !!!
! 	bit	r0,(csr)	/ current step done ?
! 	beq	2b		/ no
! 	mov	(r1)+,(csr)	/ yes, load next step info from table
! 	asl	r0		/ change state test bit to next step
! 	bpl	2b		/ if all steps not done, go back
! 				/ r0 now = 100000, TK_OWN bit
! 	mov	$400,cmdhdr+2	/ tape VCID = 1
! 	mov	$36.,cmdhdr	/ command packet length
! 				/ don't set response packet length,
! 				/ little shakey but it works.
! 				/ unit is already loaded at tkcmd+4
! 	mov	$11,tkcmd+8.	/ on-line command opcode
! 	mov	$20000,tkcmd+10.	/ set clear serious exception
! 	mov	$ring,r2	/ initialize cmd/rsp ring
! 	mov	$tkrsp,(r2)+	/ address of response packet
! 	mov	r0,(r2)+	/ set TK owner
! 	mov	$tkcmd,(r2)+	/ address of command packet
! 	mov	r0,(r2)+	/ set TK owner
! 	mov	-(csr),r0	/ start TK polling
! 3:
! 	jsr	pc,tkready
! 	mov	$tkcmd+8.,r0
! 	mov	$45,(r0)+		/ reposition opcode
! 	mov	$20002,(r0)+		/ set rewind & clear serious exception
! 	clr	(r0)+			/ clear record/object count
! 	clr	(r0)+			/ zzz2
! 	clr	(r0)+			/ clear tape mark count
! tkpoll:
! 	mov	$100000,ring+2		/ set TK owner of response
! 	mov	$100000,ring+6		/ set TK owner of command
! 	mov	(csr),r0		/ start TK polling
! tkready:
! 	tst	ring+2			/ wait for response
! 	bmi	tkready
! 	tstb	tkrsp+10.		/ does returned status = SUCCESS ?
! 	bne	.			/ no, hang
  	rts	pc
+ tkread:
+ 	mov	$tkcmd+8.,r0
+ 	mov	$41,(r0)+		/ read opcode
+ 	mov	$20000,(r0)+		/ set clear serious exception
+ 	mov	$512.,(r0)+		/ byte count
+ 	clr	(r0)+			/ zzz2
+ 	mov	memaddr,(r0)+		/ buffer address
+ 	jsr	pc,bumpaddr		/ bump address
+ 	br	tkpoll			/ wait for response
+ 
+ cmdtbl:
+ 	100000			/ TK_ERR, init step 1
+ 	ring			/ address of ringbase
+ 	0			/ hi ringbase address
+ 	go			/ TK go bit
+ 
+ table1:
+ 	.byte HT_MAJOR
+ 	.byte TMS_MAJOR
+ 	.byte TS_MAJOR
+ 	.byte TM_MAJOR
+ table2:
+ 	hrrec
+ 	tkread
+ 	tsrrec
+ 	tmrrec
+ table3:
+ 	htrew
+ 	tkrew
+ 	tsrew
+ 	tmrew
+ end:
+ 
+ major = NEWLOC+OURSIZE
+ cmdint = major+2		/ TMSCP stuff
+ rspint = cmdint+2.
+ ring = rspint+2.
+ rsphdr = ring+8.
+ tkrsp = rsphdr+4.
+ cmdhdr = tkrsp+48.
+ tkcmd = cmdhdr+4.
+ unit = tkcmd+4
*** /usr/src/sys/pdpstand.old/prf.c	Fri Aug 19 11:57:00 1988
--- /usr/src/sys/pdpstand/prf.c	Sun Apr 21 00:13:07 1991
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)prf.c	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #include "../machine/cons.h"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)prf.c	1.2 (2.11BSD) 4/20/91
   */
  
  #include "../machine/cons.h"
***************
*** 54,62 ****
   */
  printn(n, b)
  	long n;
! 	int b;
  {
! 	register long a;
  
  	if (n < 0) {	/* shouldn't happen */
  		putchar('-');
--- 54,62 ----
   */
  printn(n, b)
  	long n;
! 	register int b;
  {
! 	long a;
  
  	if (n < 0) {	/* shouldn't happen */
  		putchar('-');
*** /usr/src/sys/pdpstand.old/ra.c	Fri Sep 29 11:48:26 1989
--- /usr/src/sys/pdpstand/ra.c	Sun Apr 21 00:13:54 1991
***************
*** 3,14 ****
   * 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
   */
  
  /*
   * RAxx disk device driver
!  * RQDX1 (rx50, rd50, rd51, rd52, rd53)
   */
  #include "../h/param.h"
  #include "../h/inode.h"
--- 3,14 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	2.0 (2.11BSD) 4/20/91
   */
  
  /*
   * RAxx disk device driver
!  * RQDX?/UDA50 (rx33, rx50, rd5?, ra??)
   */
  #include "../h/param.h"
  #include "../h/inode.h"
***************
*** 16,21 ****
--- 16,30 ----
  #include "../pdpuba/rareg.h"
  #include "saio.h"
  
+ #define	NRA	2
+ 
+ 	struct	radevice *RAcsr[NRA + 1] =
+ 		{
+ 		(struct radevice *)0172150,
+ 		(struct	radevice *)0,
+ 		(struct radevice *)-1
+ 		};
+ 
  /*
   * RA Communications Area
  */
***************
*** 36,103 ****
  #define	RA_OWN	0x8000	/* RQ owns this descriptor */
  #define	RA_INT	0x4000	/* allow interrupt on ring transition */
  
- static	struct	radevice *RDADDR = ((struct radevice *)0172150);
- 
  static	struct	ra {
  	struct	rdca	ra_ca;
  	struct	mscp	ra_rsp;
  	struct	mscp	ra_cmd;
! } rd;
  
! struct 	mscp 	*racmd();
! static	int 	rdinit;
! static	long	rdonline[8];
  
- /*
-  * XXX - Not consistent with other stand alone drivers.
-  * static int	rd_boff[] = { 0, 9700, 27000, 30100, 0, 7460, 9700, 0 };
-  */
- 
  raopen(io)
  	register struct iob *io;
  {
! 	register struct mscp *mp;
! 	int i;
  
! 	if (rdinit == 0) {
! 		RDADDR->raip = 0;
! 		while ((RDADDR->rasa & RA_STEP1) == 0)
  			continue;
! 		RDADDR->rasa = RA_ERR;
! 		while ((RDADDR->rasa & RA_STEP2) == 0)
  			continue;
! 		RDADDR->rasa = (short)&rd.ra_ca.ca_ringbase;
! 		while ((RDADDR->rasa & RA_STEP3) == 0)
  			continue;
! 		RDADDR->rasa = (short)(segflag & 3);
! 		while ((RDADDR->rasa & RA_STEP4) == 0)
  			continue;
! 		RDADDR->rasa = RA_GO;
! 		rd.ra_ca.ca_rspl = (short)&rd.ra_rsp.m_cmdref;
! 		rd.ra_ca.ca_rsph = (short)(segflag & 3);
! 		rd.ra_ca.ca_cmdl = (short)&rd.ra_cmd.m_cmdref;
! 		rd.ra_ca.ca_cmdh = (short)(segflag & 3);
! 		rd.ra_cmd.m_cntflgs = 0;
! 		if ((int)racmd(M_O_STCON, 0) < 0) {
! 			printf("RD: controller init error, STCON\n");
  			return(-1);
  		}
! 		rdinit = 1;
  	}
  
! 	if (rdonline[io->i_unit & 7] == 0)
  		if (ramount(io) == -1)
  			return(-1);
- 
- 	/*
- 	 * XXX - Not consistent with other stand alone drivers.
- 	 * if ((io->i_boff < 0) || (io->i_boff > 7) ||
- 	 *    (rd_boff[io->i_boff] == -1)) {
- 	 *	printf("RD: bad partition for unit=%d", io->i_unit & 7);
- 	 * }
- 	 * io->i_boff = rd_boff[io->i_boff];
- 	 */
- 
  	return(0);
  }
  
--- 45,102 ----
  #define	RA_OWN	0x8000	/* RQ owns this descriptor */
  #define	RA_INT	0x4000	/* allow interrupt on ring transition */
  
  static	struct	ra {
  	struct	rdca	ra_ca;
  	struct	mscp	ra_rsp;
  	struct	mscp	ra_cmd;
! } rd[NRA];
  
! static	u_char 	rainit[NRA];
! static	long	raonline[NRA][8];
  
  raopen(io)
  	register struct iob *io;
  {
! 	register struct radevice *raaddr;
! 	register struct ra *racom;
! 	int i, ctlr, unit;
  
! 	ctlr = CTLRn(io->i_unit);
! 	unit = UNITn(io->i_unit);
! 	if (genopen(NRA, io) < 0)
! 		return(-1);
! 	raaddr = RAcsr[ctlr];
! 	racom = &rd[ctlr];
! 
! 	if (rainit[ctlr] == 0) {
! 		raaddr->raip = 0;
! 		while ((raaddr->rasa & RA_STEP1) == 0)
  			continue;
! 		raaddr->rasa = RA_ERR;
! 		while ((raaddr->rasa & RA_STEP2) == 0)
  			continue;
! 		raaddr->rasa = (short)&racom->ra_ca.ca_ringbase;
! 		while ((raaddr->rasa & RA_STEP3) == 0)
  			continue;
! 		raaddr->rasa = (short)(segflag & 3);
! 		while ((raaddr->rasa & RA_STEP4) == 0)
  			continue;
! 		raaddr->rasa = RA_GO;
! 		racom->ra_ca.ca_rspl = (short)&racom->ra_rsp.m_cmdref;
! 		racom->ra_ca.ca_rsph = (short)(segflag & 3);
! 		racom->ra_ca.ca_cmdl = (short)&racom->ra_cmd.m_cmdref;
! 		racom->ra_ca.ca_cmdh = (short)(segflag & 3);
! 		racom->ra_cmd.m_cntflgs = 0;
! 		if (racmd(M_O_STCON, 0) < 0) {
! 			printf("RA%d ctlr STCON err\n", ctlr);
  			return(-1);
  		}
! 		rainit[ctlr] = 1;
  	}
  
! 	if (raonline[ctlr][unit] == 0)
  		if (ramount(io) == -1)
  			return(-1);
  	return(0);
  }
  
***************
*** 104,110 ****
  raclose(io)
  	register struct iob *io;
  {
! 	rdonline[io->i_unit & 7] = 0;
  	return(0);
  }
  
--- 103,109 ----
  raclose(io)
  	register struct iob *io;
  {
! 	raonline[CTLRn(io->i_unit)][UNITn(io->i_unit)] = 0;
  	return(0);
  }
  
***************
*** 111,152 ****
  ramount(io)
  	register struct iob *io;
  {
! 	if ((int)racmd(M_O_ONLIN, io->i_unit) < 0) {
! 		printf("RD: bring online error, unit=%d\n", io->i_unit & 7);
  		return(-1);
  	}
! 	rdonline[io->i_unit & 7] = rd.ra_rsp.m_uslow +  
! 		((long)(rd.ra_rsp.m_ushigh) << 16);
  	return(0);
  }
  
- struct mscp *
  racmd(op, unit)
  	int op, unit;
  {
  	register struct mscp *mp;
! 	register int i;
  
! 	rd.ra_cmd.m_opcode = op;
! 	rd.ra_cmd.m_unit = unit & 7;
! 	rd.ra_rsp.m_header.ra_msglen = sizeof(struct mscp);
! 	rd.ra_cmd.m_header.ra_msglen = sizeof(struct mscp);
! 	rd.ra_ca.ca_rsph = RA_OWN | RA_INT | (segflag & 3);
! 	rd.ra_ca.ca_cmdh = RA_OWN | RA_INT | (segflag & 3);
! 	i = RDADDR->raip;
  	while (1) {
! 		if (rd.ra_ca.ca_cmdint)
! 			rd.ra_ca.ca_cmdint = 0;
! 		if (rd.ra_ca.ca_rspint)
  			break;
  	}
! 	rd.ra_ca.ca_rspint = 0;
! 	mp = &rd.ra_rsp;
! 	if (((mp->m_opcode & 0xff) != (op | M_O_END)) ||
  	    ((mp->m_status & M_S_MASK) != M_S_SUCC)) {
! 		printf("RD: command error, unit=%d, opcode=%x, status=%x\n",
! 			unit & 7, mp->m_opcode & 0xff, mp->m_status);
! 		return((struct mscp *)-1);
  	}
  	return(0);
  }
--- 110,155 ----
  ramount(io)
  	register struct iob *io;
  {
! 	register int ctlr = CTLRn(io->i_unit);
! 	register int unit = UNITn(io->i_unit);
! 
! 	if (racmd(M_O_ONLIN, io->i_unit) < 0) {
! 		printf("RA%d,%d: online err\n", ctlr, unit);
  		return(-1);
  	}
! 	raonline[ctlr][unit] = rd[ctlr].ra_rsp.m_uslow +  
! 		((long)(rd[ctlr].ra_rsp.m_ushigh) << 16);
  	return(0);
  }
  
  racmd(op, unit)
  	int op, unit;
  {
  	register struct mscp *mp;
! 	register int ctlr = CTLRn(unit);
! 	register struct ra *racom = &rd[ctlr];
! 	int i;
  
! 	racom->ra_cmd.m_opcode = op;
! 	racom->ra_cmd.m_unit = UNITn(unit);
! 	racom->ra_rsp.m_header.ra_msglen = sizeof(struct mscp);
! 	racom->ra_cmd.m_header.ra_msglen = sizeof(struct mscp);
! 	racom->ra_ca.ca_rsph = RA_OWN | RA_INT | (segflag & 3);
! 	racom->ra_ca.ca_cmdh = RA_OWN | RA_INT | (segflag & 3);
! 	i = RAcsr[ctlr]->raip;
  	while (1) {
! 		if (racom->ra_ca.ca_cmdint)
! 			racom->ra_ca.ca_cmdint = 0;
! 		if (racom->ra_ca.ca_rspint)
  			break;
  	}
! 	racom->ra_ca.ca_rspint = 0;
! 	mp = &racom->ra_rsp;
! 	if ((mp->m_opcode != (op | M_O_END)) ||
  	    ((mp->m_status & M_S_MASK) != M_S_SUCC)) {
! 		printf("RA%d,%d: cmd err op=%x, sts=%x\n",
! 			ctlr, unit, mp->m_opcode, mp->m_status);
! 		return(-1);
  	}
  	return(0);
  }
***************
*** 155,172 ****
  	register struct iob *io;
  {
  	register struct mscp *mp;
  
! 	if (io->i_bn >= rdonline[io->i_unit & 7])
  		return(0);
  
! 	mp = &rd.ra_cmd;
  	mp->m_lbn_l = loint(io->i_bn);
  	mp->m_lbn_h = hiint(io->i_bn);
  	mp->m_bytecnt = io->i_cc;
  	mp->m_buf_l = (ushort)io->i_ma;
  	mp->m_buf_h = segflag & 3;
! 	if ((int)racmd(func == READ ? M_O_READ : M_O_WRITE, io->i_unit) < 0)
  		return(-1);
- 
  	return(io->i_cc);
  }
--- 158,177 ----
  	register struct iob *io;
  {
  	register struct mscp *mp;
+ 	struct ra *racom;
+ 	register int ctlr = CTLRn(io->i_unit);
  
! 	if (io->i_bn >= raonline[ctlr][UNITn(io->i_unit)])
  		return(0);
  
! 	racom = &rd[ctlr];
! 	mp = &racom->ra_cmd;
  	mp->m_lbn_l = loint(io->i_bn);
  	mp->m_lbn_h = hiint(io->i_bn);
  	mp->m_bytecnt = io->i_cc;
  	mp->m_buf_l = (ushort)io->i_ma;
  	mp->m_buf_h = segflag & 3;
! 	if (racmd(func == READ ? M_O_READ : M_O_WRITE, io->i_unit) < 0)
  		return(-1);
  	return(io->i_cc);
  }

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 8 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 8 of 22

Changes were made to the MSCP driver to use an externally mapped
packet arena.  This saves slightly more than 1kb of kernel D space
per controller.

Closer attention is paid to the fact a drive went offline (changing
floppies, etc).

The size returned in the online packet is NOT adjusted (reduced)!  The
RCT area is already taken into account by the controller.  This
results in extra space being available on the disc.  It is safe to
make this patch to an existing/running system - but, to use the
extra space you will have to dump the filesystem, do a 'newfs' and
reload.

*** /usr/src/sys/pdpuba/ra.c.old	Sun Jul  1 22:17:02 1990
--- /usr/src/sys/pdpuba/ra.c	Fri May 10 20:40:03 1991
***************
*** 3,36 ****
   * 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)
--- 3,42 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ra.c	2.0 (2.11BSD Berkeley) 3/16/91
   */
  
   /***********************************************************************
   *			Copyright (c) 1983 by				*
   *		Digital Equipment Corporation, Maynard, MA		*
   *			All rights reserved.				*
   ***********************************************************************/
  
  /* 
!  * ra.c - MSCP Driver
   * 
!  * 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
   *
   * Should work with the following (at least!):
   *	RUX1  (RX50, RX33)
***************
*** 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)
  
--- 58,69 ----
  #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)
  
***************
*** 131,141 ****
  	-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)
--- 135,140 ----
***************
*** 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 */
--- 167,173 ----
  	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 */
***************
*** 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
--- 193,203 ----
  } 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,233 ****
  #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 */
--- 224,231 ----
  #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 */
***************
*** 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)
--- 242,251 ----
   * 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);
  	}
  
--- 256,263 ----
  	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 */
--- 287,305 ----
   * 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;
--- 331,336 ----
***************
*** 347,361 ****
  			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);
  	}
  
--- 341,364 ----
  			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
--- 372,388 ----
  		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));
  
--- 394,407 ----
  	/*
  	 * 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,464 ****
  	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)
--- 423,437 ----
  	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)]) == NULL || disk->ra_dsize <= 0L)
***************
*** 508,517 ****
  	if (sc->sc_ctab.b_active == 0) {
  		rastart(sc);
  	}
- 
  	splx(s);
  	return;
- 
  bad:
  	bp->b_flags |= B_ERROR;
  	iodone(bp);
--- 481,488 ----
***************
*** 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?
--- 489,530 ----
  	return;
  }
  
! struct buf *
! rartab(dev)
! 	register dev_t dev;
  {
! 	register ra_softcT *sc = &ra_sc[RACON(dev)];
  
! 	return(&sc->sc_drives[RAUNIT(dev)]->ra_rtab);
  }
  
  raread(dev, uio)
! 	register dev_t 	dev;
  	struct	uio *uio;
  {
! 	return(physio(rastrategy, rartab(dev), dev, B_READ, WORD, uio));
  }
  
  rawrite(dev, uio)
! 	register dev_t 	dev;
  	struct	uio *uio;
  {
! 	return(physio(rastrategy, rartab(dev), 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;
! 	segm	seg5;
  
+ 	saveseg5(seg5);		/* save it just once */
  loop:
  	/* 
  	 * Anything left to do on this controller?
***************
*** 582,588 ****
--- 536,544 ----
  		 * Check for response ring transitions lost in race
  		 * condition
  		 */
+ 		mapseg5(ra_com[sc->sc_unit], MAPSEGDESC);
  		rarspring(sc);
+ 		restorseg5(seg5);
  		return(0);
  	}
  
***************
*** 601,616 ****
  	++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);
--- 557,575 ----
  	++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);
***************
*** 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
--- 628,644 ----
  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 ****
--- 684,690 ----
  		/*
  		 * 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 ****
--- 699,705 ----
  		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:
***************
*** 758,763 ****
--- 722,729 ----
  		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);
  }
  
--- 748,758 ----
  		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 */
--- 760,777 ----
   * 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) {
--- 791,804 ----
  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 = 
--- 807,821 ----
  		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; 
--- 825,833 ----
  
  /* 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
--- 846,858 ----
   * 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
--- 875,881 ----
  	 * 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,931 ****
  	/*
  	 * 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");
--- 888,894 ----
  	/*
  	 * 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");
***************
*** 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:
--- 926,932 ----
  		/* 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:
***************
*** 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)
--- 959,973 ----
  		}
  #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;
--- 981,987 ----
  		}
  		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,1041 ****
  		break;
  
  	default:
! 		printf("ra: unknown packet opcode=0%o\n", mp->m_opcode & 0xff);
  		ra_error((caddr_t)mp);
  	}
  }
--- 992,998 ----
  		break;
  
  	default:
! 		log(LOG_INFO,"ra: unknown opcode=0%o\n", mp->m_opcode);
  		ra_error((caddr_t)mp);
  	}
  }
***************
*** 1061,1067 ****
  	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 */
--- 1018,1023 ----
***************
*** 1071,1101 ****
  		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);
  	}
  }
  
--- 1027,1051 ----
  		case 52:/* RD Hard disks */
  		case 53:
  			disk->ra_size = rd52_sizes;
  			break;
  		case 54:
  			disk->ra_size = rd54_sizes;
  			break;
! 		case 60:
  			disk->ra_size = ra60_sizes;
  			break;
  		case 80:
  			disk->ra_size = ra80_sizes;
  			break;
  		case 81:
  			disk->ra_size = ra81_sizes;
  			break;
  		case 82:
  			disk->ra_size = ra82_sizes;
  			break;
  		default:
  			printf("ra: disk type %d unknown\n",
! 				 hiint(mp->m_mediaid) & 0xff);
  	}
  }
  
***************
*** 1104,1110 ****
   *
   * 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;
--- 1054,1061 ----
   *
   * 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 */
  	{
--- 1065,1092 ----
  
  	switch (mp->me_format) {
  	case M_F_CNTERR:
! 		printf("controller");
  		break;
  	case M_F_BUSADDR:
! 		printf("host memory access addr 0%o", mp->me_busaddr);
  		break;
  	case M_F_DISKTRN:
! 		printf("disk transfer, unit %d grp 0x%x hdr 0x%x",
  			mp->me_unit, mp->me_group, mp->me_hdr);
  		break;
  	case M_F_SDI:
! 		printf("SDI, unit %d hdr 0x%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("unknown, unit %d format 0%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;
--- 1110,1127 ----
  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));
--- 1132,1150 ----
  		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"));
--- 1163,1171 ----
  	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;
--- 1219,1242 ----
  
  		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);
--- 1251,1257 ----
  		/*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);

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 10 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 10 of 22

Second portion of the RL02 driver fix.

*** /usr/src/sys/pdpuba/rlreg.h.old	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 ----

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 11 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 11 of 22

The TMSCP (TK50/TU81) driver was modified to use an externally mapped
communication packet arena.  Also a number of changes were made to
reduce the size of the driver.  Other fixes dealing with onlining
the unit were made.  Space savings were achieved partially by altering
the error messages.

*** /usr/src/sys/pdpuba/tmscp.c.old	Wed Dec 19 10:11:09 1990
--- /usr/src/sys/pdpuba/tmscp.c	Fri May 10 20:42:24 1991
***************
*** 1,4 ****
! /*	@(#)tmscp.c	7.1 (Berkeley) 6/5/86 */
  
  #if	!defined(lint) && defined(DOSCCS)
  static	char	*sccsid = "@(#)tmscp.c	1.24	(ULTRIX)	1/21/86";
--- 1,4 ----
! /*	@(#)tmscp.c	1.1 (2.11BSD) 5/10/91 */
  
  #if	!defined(lint) && defined(DOSCCS)
  static	char	*sccsid = "@(#)tmscp.c	1.24	(ULTRIX)	1/21/86";
***************
*** 32,40 ****
   * 
   * Modification History:
   *
   * 17-Jun-90,14Aug90 - sms@wlv.imsd.contel.com
   *	Began porting to 2.10.1BSD/2.11BSD.  Multiple drives per controller
!  *	NOT supported, although multiple controllers are.  Programmable
   *	vectors don't work very well with the autoconfigure scheme in use.
   *	the define TMSCP_VEC will have to be adjusted in tms.h (see
   *	conf/config and the sample config files).  For patching purposes
--- 32,70 ----
   * 
   * Modification History:
   *
+  * 29-Mar-91 - sms@wlv.imsd.contel.com [2.11BSD]
+  *	Major changes to 1) support multiple drives per controller
+  *	(the maximum number of drives per controller is 4 for now in order
+  *	to maximize compatibility with existing minor device numbers - the
+  *	norewind and density bit stay in the same place) and 2) more
+  *	importantly reduce the bloat of this driver.  The command
+  *	packet area is now allocated from an external heap setup at boot
+  *	time (the MSCP, ra.c driver also does this).  Allocating from an
+  * 	external arena save approximately 2kb of kernel D space PER CONTROLLER
+  *	and costs little in speed because the amount of remapping involved is
+  *	quite small.
+  *
+  *	The 'errinfo' routine was removed in the interest of space savings,
+  *	the error code was already being printed out in hex and it's not
+  *	worth eating up another 250 or so bytes of kernel D space to pretty
+  *	print messages for which tmscp.h provides the cross reference (I space
+  *	is also saved by not printing the messages).  Besides, the ra.c (MSCP)
+  *	driver doesn't do it and it is worth a degree of non 4.3BSD verisimility
+  *	to save a significant amount of space.
+  *
+  *	The tms_type field should have been a 'long' (mediatype).  Since the
+  *	drives are not probed at autoconfigure time a GTUNT (TMS_SENSE) command
+  *	is done at open() time to fetch the format/density menu and unit flags.
+  *	iodone() proccessing was missing for the GTUNT function in tmscprsp()
+  *	causing hangs in both open and ioctl functions.
+  *
+  *	Multiple controller support made to work, the top 2 bits of the minor
+  *	device number are used to designate the controller, thus there is
+  *	a maximum of 4 TMSCP controllers per system.
+  *
   * 17-Jun-90,14Aug90 - sms@wlv.imsd.contel.com
   *	Began porting to 2.10.1BSD/2.11BSD.  Multiple drives per controller
!  *	NOT supported, although multiple controllers are (maybe).  Programmable
   *	vectors don't work very well with the autoconfigure scheme in use.
   *	the define TMSCP_VEC will have to be adjusted in tms.h (see
   *	conf/config and the sample config files).  For patching purposes
***************
*** 162,167 ****
--- 192,198 ----
  	struct	tmscpdevice *sc_addr;	/* controller CSR address */
  	short   sc_state;       /* state of controller */
  	short	sc_ivec;        /* interrupt vector address */
+ 	short	sc_unit;	/* CONTROLLER number - NOT drive unit # */
  	short   sc_credits;     /* transfer credits */
  	short   sc_lastcmd;     /* pointer into command ring */
  	short   sc_lastrsp;     /* pointer into response ring */
***************
*** 169,174 ****
--- 200,206 ----
  	struct	buf sc_ctab;	/* controller queue */
  	struct	buf sc_wtab;	/* I/O wait queue for controller */
  	struct	tmscp *sc_com;	/* communications area pointer */
+ 	struct	tms_info *sc_drives[4];	/* pointers to per drive info */
  } tmscp_softc[NTMSCP];
  
  #define	RINGBASE	(4 * sizeof (short))
***************
*** 177,190 ****
  	struct tmscpca	tmscp_ca;         /* communications area */
  	struct mscp	tmscp_rsp[NRSP];  /* response packets */
  	struct mscp	tmscp_cmd[NCMD];  /* command packets */
! } tmscp[NTMSCP];
  
  /*
   * Per drive-unit info
   */
  struct tms_info {
  	daddr_t		tms_dsize;	/* Max user size from online pkt */
! 	unsigned	tms_type;	/* Drive type int field  */
  	int		tms_resid;	/* residual from last xfer */
  	u_char		tms_endcode;	/* last command endcode */
  	u_char		tms_flags;	/* last command end flags */
--- 209,224 ----
  	struct tmscpca	tmscp_ca;         /* communications area */
  	struct mscp	tmscp_rsp[NRSP];  /* response packets */
  	struct mscp	tmscp_cmd[NCMD];  /* command packets */
! };					  /* 1896 bytes per controller! */
  
+ 	memaddr	tmscp[NTMSCP];		/* click addresses of ctrl comm area */
+ 
  /*
   * Per drive-unit info
   */
  struct tms_info {
  	daddr_t		tms_dsize;	/* Max user size from online pkt */
! 	long		tms_type;	/* Drive type field  */
  	int		tms_resid;	/* residual from last xfer */
  	u_char		tms_endcode;	/* last command endcode */
  	u_char		tms_flags;	/* last command end flags */
***************
*** 199,218 ****
  	struct tty	*tms_ttyp;	/* record user's tty for errors */
  	struct	buf	tms_dtab;	/* I/O tape drive queues */
  	struct	buf	tms_rtab;	/* raw I/O tape block header */
! 	short		tms_online;	/* online flag */
  } tms_info[NTMS];
  
- struct	buf	tmscomphys;		/* Communication area phys map */
- long	tmsphys();
- 
- #ifndef	KDSA0
- #define KDSA0		((u_short *)0172360)
- #endif
  /* Bits in minor device */
  #define	TMSUNIT(dev)	(minor(dev)&03)
  #define	T_NOREWIND	04
  #define	T_HIDENSITY	010
  
  /*
   * Internal (ioctl) command codes (these must also be declared in the
   * tmscpioctl routine).  These correspond to ioctls in mtio.h
--- 233,250 ----
  	struct tty	*tms_ttyp;	/* record user's tty for errors */
  	struct	buf	tms_dtab;	/* I/O tape drive queues */
  	struct	buf	tms_rtab;	/* raw I/O tape block header */
! 	short		tms_online;	/* 0=available, 1=online, -1=offline */
  } tms_info[NTMS];
  
  /* Bits in minor device */
  #define	TMSUNIT(dev)	(minor(dev)&03)
+ #define	TMSCTLR(dev)	((minor(dev) >> 6) & 3)
  #define	T_NOREWIND	04
  #define	T_HIDENSITY	010
  
+ /* Size to map in when mapping a controller's command packet area */
+ #define	MAPBUFDESC	(((btoc(sizeof (struct tmscp)) - 1) << 8) | RW)
+ 
  /*
   * Internal (ioctl) command codes (these must also be declared in the
   * tmscpioctl routine).  These correspond to ioctls in mtio.h
***************
*** 247,252 ****
--- 279,285 ----
  				/* packets and or credits. */
  int	wakeup();
  extern	int	hz;		/* Should find the right include */
+ extern	long	_iomap();
  
  #ifdef	TMSCP_DEBUG
  #define printd if (tmscpdebug) printf
***************
*** 259,282 ****
  #define b_qsize         b_resid         /* queue size per drive, in tmsutab */
  
  /* 
-  * Set ui flags to zero to show device is not online & set tmscpip.
-  * Unit to Controller mapping is set up here.
   * Open routine will issue the online command, later.
   */
  tmsattach(addr, unit)
  	struct tmscpdevice *addr;
  	register int unit;
  {
! 	register struct tmscp_softc *sc = &tmscp_softc[TMSUNIT(unit)];
  
  	if (sc->sc_addr == NULL && addr != NULL) {
  		sc->sc_addr = addr;
! 		sc->sc_com = &tmscp[TMSUNIT(unit)];
  		return (1);
  	}
  	return(0);
  }
  
  /*
   * TMSCP interrupt routine.
   */
--- 292,338 ----
  #define b_qsize         b_resid         /* queue size per drive, in tmsutab */
  
  /* 
   * Open routine will issue the online command, later.
+  *
+  * This routine attaches controllers, not drives - sc_unit and 'unit' are 
+  * the controller number not a drive unit number.  sc_com is initialized
+  * to SEG5 because all communication areas are mapped to the same virtual
+  * address now.
   */
  tmsattach(addr, unit)
  	struct tmscpdevice *addr;
  	register int unit;
  {
! 	register struct tmscp_softc *sc = &tmscp_softc[unit];
  
+ 	if (unit >= NTMSCP)
+ 		return(0);
  	if (sc->sc_addr == NULL && addr != NULL) {
+ 		tmscp[unit] = (memaddr)_ioget(sizeof (struct tmscp));
+ 		if (tmscp[unit] == NULL)
+ 			return(0);
  		sc->sc_addr = addr;
! 		sc->sc_unit = unit;
! 		sc->sc_com = (struct tmscp *)SEG5;
  		return (1);
  	}
  	return(0);
  }
  
+ struct tms_info *
+ getdd()
+ {
+ 	register int i;
+ 	register struct tms_info *p;
+ 
+ 	for (i = NTMS, p = tms_info; i--; p++) {
+ 		if (p->tms_online == 0)
+ 			return(p);
+ 	}
+ 	log(TMS_PRI, "tms: no drive descriptors\n");
+ 	return(NULL);
+ }
+ 
  /*
   * TMSCP interrupt routine.
   */
***************
*** 283,295 ****
  tmsintr(dev)
  	dev_t dev;
  {
- 	int unit = TMSUNIT(dev);
  	register struct tmscpdevice *tmscpaddr;
  	struct buf *bp;
  	register int i;
! 	register struct tmscp_softc *sc = &tmscp_softc[unit];
! 	register struct tmscp *tm = &tmscp[unit];
  	struct mscp *mp;
  
  	tmscpaddr = sc->sc_addr;
  #ifdef TMSCP_DEBUG
--- 339,351 ----
  tmsintr(dev)
  	dev_t dev;
  {
  	register struct tmscpdevice *tmscpaddr;
  	struct buf *bp;
  	register int i;
! 	register struct tmscp_softc *sc = &tmscp_softc[dev];
! 	register struct tmscp *tm = sc->sc_com;
  	struct mscp *mp;
+ 	segm seg5;
  
  	tmscpaddr = sc->sc_addr;
  #ifdef TMSCP_DEBUG
***************
*** 302,308 ****
  	switch (sc->sc_state) {
  
  	case S_IDLE:
! 		printf("tms%d: random interrupt ignored\n", unit);
  		return;
  
  	/* Controller was in step 1 last, see if its gone to step 2 */
--- 358,364 ----
  	switch (sc->sc_state) {
  
  	case S_IDLE:
! 		printf("tms%d: random interrupt ignored\n", dev);
  		return;
  
  	/* Controller was in step 1 last, see if its gone to step 2 */
***************
*** 402,407 ****
--- 458,465 ----
  	    /*
  	     * Initialize the data structures (response and command queues).
  	     */
+ 	    saveseg5(seg5);
+ 	    mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  	    tmsginit(sc, sc->sc_com->tmscp_ca.ca_rspdsc, sc->sc_com->tmscp_rsp,
  			0, NRSP, TMSCP_OWN|TMSCP_INT);
  	    tmsginit(sc, sc->sc_com->tmscp_ca.ca_cmddsc, sc->sc_com->tmscp_cmd,
***************
*** 425,430 ****
--- 483,489 ----
  	    mp->mscp_opcode = M_OP_STCON;
  	    ((Trl *)mp->mscp_dscptr)->hsh |= TMSCP_OWN|TMSCP_INT;
  	    i = tmscpaddr->tmscpip;      /* initiate polling */
+ 	    restorseg5(seg5);
  	    return;
  
  	case S_SCHAR:
***************
*** 432,438 ****
  		break;
  
  	default:
! 	    printf("tms%d: interrupt in unknown state %d ignored\n",unit,sc->sc_state);
  	    return;
  	}	/* end switch */
  
--- 491,497 ----
  		break;
  
  	default:
! 	    printf("tms%d: interrupt in unknown state %d ignored\n",dev,sc->sc_state);
  	    return;
  	}	/* end switch */
  
***************
*** 446,452 ****
  	 */
  	if (tmscpaddr->tmscpsa&TMSCP_ERR)
  		{
! 		printf("tms%d: fatal error (%o)\n", unit, tmscpaddr->tmscpsa);
  		tmscpaddr->tmscpip = 0;
  		sc->sc_state = S_IDLE;
  		sc->sc_ctab.b_active = 0;
--- 505,511 ----
  	 */
  	if (tmscpaddr->tmscpsa&TMSCP_ERR)
  		{
! 		printf("tms%d: fatal error %o\n", dev, tmscpaddr->tmscpsa);
  		tmscpaddr->tmscpip = 0;
  		sc->sc_state = S_IDLE;
  		sc->sc_ctab.b_active = 0;
***************
*** 455,460 ****
--- 514,521 ----
  	/*
  	 * Check for a buffer purge request. (Won't happen w/ TK50 on Q22 bus)
  	 */
+ 	saveseg5(seg5);
+ 	mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  	if (tm->tmscp_ca.ca_bdp)
  		{
  		tm->tmscp_ca.ca_bdp = 0;
***************
*** 472,478 ****
  			i %= NRSP;
  			if (tm->tmscp_ca.ca_rspdsc[i].hsh&TMSCP_OWN)
  			    break;
! 			tmscprsp(unit, tm, sc, i);
  			tm->tmscp_ca.ca_rspdsc[i].hsh |= TMSCP_OWN;
  			}
  		sc->sc_lastrsp = i;
--- 533,539 ----
  			i %= NRSP;
  			if (tm->tmscp_ca.ca_rspdsc[i].hsh&TMSCP_OWN)
  			    break;
! 			tmscprsp(sc, i);
  			tm->tmscp_ca.ca_rspdsc[i].hsh |= TMSCP_OWN;
  			}
  		sc->sc_lastrsp = i;
***************
*** 488,494 ****
  #endif		
  		tm->tmscp_ca.ca_cmdint = 0;
  		}
!     	if(tmscp_cp_wait)
  		wakeup((caddr_t)&tmscp_cp_wait);
      	(void) tmsstart(sc);
  }
--- 549,556 ----
  #endif		
  		tm->tmscp_ca.ca_cmdint = 0;
  		}
! 	restorseg5(seg5);
!     	if (tmscp_cp_wait)
  		wakeup((caddr_t)&tmscp_cp_wait);
      	(void) tmsstart(sc);
  }
***************
*** 504,510 ****
  	dev_t dev;
  	int flag;
  {
! 	register int unit;
  	register struct tmscp_softc *sc;
  	register struct tms_info *tms;
  	register struct mscp *mp;
--- 566,573 ----
  	dev_t dev;
  	int flag;
  {
! 	register int unit = TMSUNIT(dev);
! 	int ctlr = TMSCTLR(dev);
  	register struct tmscp_softc *sc;
  	register struct tms_info *tms;
  	register struct mscp *mp;
***************
*** 511,529 ****
  	struct tmscpdevice *tmscpaddr;
  	int s,i;
  	
- 	unit = TMSUNIT(dev);
  #ifdef TMSCP_DEBUG
! 	printd("tmscpopen unit %d\n",unit);
! 	if(tmscpdebug)delay(10000L);
  #endif
! 	if (unit >= NTMS)
  		return (ENXIO);
- 	tms = &tms_info[unit];
- 	if (tms->tms_openf)
- 		return (EBUSY);
  	sc = &tmscp_softc[unit];
  	if (sc->sc_addr == NULL)
  		return (ENXIO);
  	tms->tms_openf = 1;
  	tms->tms_ttyp = u.u_ttyp;
  	s = spl5();
--- 574,597 ----
  	struct tmscpdevice *tmscpaddr;
  	int s,i;
  	
  #ifdef TMSCP_DEBUG
! 	printd("tmscpopen %d,%d\n", ctlr, unit);
! 	if (tmscpdebug) delay(10000L);
  #endif
! 	if (ctlr >= NTMSCP)
  		return (ENXIO);
  	sc = &tmscp_softc[unit];
  	if (sc->sc_addr == NULL)
  		return (ENXIO);
+ 	if ((tms = sc->sc_drives[unit]) == NULL) {
+ 		tms = getdd();
+ 		if (!tms)
+ 			return(ENXIO);
+ 		tms->tms_online = -1;
+ 		sc->sc_drives[unit] = tms;
+ 	}
+ 	if (tms->tms_openf)
+ 		return(EBUSY);
  	tms->tms_openf = 1;
  	tms->tms_ttyp = u.u_ttyp;
  	s = spl5();
***************
*** 532,538 ****
  		if (sc->sc_state == S_IDLE)
  			if(!tkini(sc))
  				{
! 				printf("tms ctrl failed to init\n");
  				(void) splx(s);
  				return(ENXIO);
  				}
--- 600,606 ----
  		if (sc->sc_state == S_IDLE)
  			if(!tkini(sc))
  				{
! 				printf("tms%d failed to init\n", ctlr);
  				(void) splx(s);
  				return(ENXIO);
  				}
***************
*** 543,550 ****
  		sleep((caddr_t)&sc->sc_ctab, PSWP+1);
  		if (sc->sc_state != S_RUN)
  			{
  			(void) splx(s);
- 			tms->tms_openf = 0;
  			return (EIO);
  			}
  		}
--- 611,619 ----
  		sleep((caddr_t)&sc->sc_ctab, PSWP+1);
  		if (sc->sc_state != S_RUN)
  			{
+ 			sc->sc_drives[unit] = NULL;
+ 			tms->tms_online = tms->tms_openf = 0;
  			(void) splx(s);
  			return (EIO);
  			}
  		}
***************
*** 554,563 ****
  	 */
  	tmscpaddr = (struct tmscpdevice *) sc->sc_addr;
  	(void) splx(s);
! 	if(tms->tms_online == 0)
  		{
  		s = spl5();
! 		while((mp = tmscpgetcp(sc)) == 0)
  			{
  			tmscp_cp_wait++;
  			sleep((caddr_t)&tmscp_cp_wait,PSWP+1);
--- 623,632 ----
  	 */
  	tmscpaddr = (struct tmscpdevice *) sc->sc_addr;
  	(void) splx(s);
! 	if(tms->tms_online == -1)
  		{
  		s = spl5();
! 		while ((mp = tmscpgetcp(sc)) == 0)
  			{
  			tmscp_cp_wait++;
  			sleep((caddr_t)&tmscp_cp_wait,PSWP+1);
***************
*** 564,577 ****
  			tmscp_cp_wait--;
  			}
  		(void) splx(s);
  		mp->mscp_opcode = M_OP_ONLIN;
! 		mp->mscp_unit = 0;		/* unit? */
  		mp->mscp_cmdref = (u_short)&tms->tms_type;
  					    /* need to sleep on something */
  #ifdef TMSCP_DEBUG
! 		printd("tmscpopen: bring unit %d online\n",unit);
  #endif	
  		((Trl *)mp->mscp_dscptr)->hsh |= TMSCP_OWN | TMSCP_INT;
  		i = tmscpaddr->tmscpip;
  		/* 
  		 * To make sure we wake up, timeout in 240 seconds.
--- 633,648 ----
  			tmscp_cp_wait--;
  			}
  		(void) splx(s);
+ 		mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  		mp->mscp_opcode = M_OP_ONLIN;
! 		mp->mscp_unit = unit;		/* unit? */
  		mp->mscp_cmdref = (u_short)&tms->tms_type;
  					    /* need to sleep on something */
  #ifdef TMSCP_DEBUG
! 		printd("tmscpopen: bring unit %d,%d online\n",ctlr, unit);
  #endif	
  		((Trl *)mp->mscp_dscptr)->hsh |= TMSCP_OWN | TMSCP_INT;
+ 		normalseg5();
  		i = tmscpaddr->tmscpip;
  		/* 
  		 * To make sure we wake up, timeout in 240 seconds.
***************
*** 579,591 ****
  		 * 240 seconds (4 minutes) is necessary since a rewind
  		 * can take a few minutes.
  		 */
! 		timeout(wakeup,(caddr_t) mp->mscp_cmdref,240 * hz);
! 		sleep((caddr_t) mp->mscp_cmdref,PSWP+1);
  		}
! 	if(tms->tms_online == 0) {
! 		tms->tms_openf = 0;
  		return(ENXIO);  /* Didn't go online */
! 	}
  	tms->tms_lastiow = 0;
  	/*
  	 * If the high density device is not specified, set unit to low
--- 650,675 ----
  		 * 240 seconds (4 minutes) is necessary since a rewind
  		 * can take a few minutes.
  		 */
! 		timeout(wakeup,(caddr_t) &tms->tms_type,240 * hz);
! 		sleep((caddr_t) &tms->tms_type,PSWP+1);
  		}
! 	if	(tms->tms_online == -1)
! 		{
! oops:		tms->tms_online = tms->tms_openf = 0;
! 		sc->sc_drives[unit] = NULL;
  		return(ENXIO);  /* Didn't go online */
! 		}
! 	/*
! 	 * Get the unit characteristics (GTUNT).  Done here because we
! 	 * do not check for slave units at autoconfigure time.  This really
! 	 * only need be done once, but it's easier to do it on each open.
! 	 * tmscpcommand() is used since the iodone() handling for GTUNT has
! 	 * been fixed.
! 	*/
! 	tms->tms_type = 0;
! 	tmscpcommand(dev, TMS_SENSE, 1);
! 	if	(tms->tms_type == 0)
! 		goto oops;
  	tms->tms_lastiow = 0;
  	/*
  	 * If the high density device is not specified, set unit to low
***************
*** 619,632 ****
  	register dev_t dev;
  	register flag;
  {
  	register struct tms_info *tms;
  	int unit = TMSUNIT(dev);
  
  #ifdef TMSCP_DEBUG
! 	printd("tmscpclose: unit = %d\n", unit);
  	if(tmscpdebug)delay(10000L);
  #endif
! 	tms = &tms_info[unit];
  	if (flag == FWRITE || (flag&FWRITE) && tms->tms_lastiow)
  		{
  		/*	   device, command, count */
--- 703,718 ----
  	register dev_t dev;
  	register flag;
  {
+ 	struct tmscp_softc *sc;
  	register struct tms_info *tms;
  	int unit = TMSUNIT(dev);
  
  #ifdef TMSCP_DEBUG
! 	printd("tmscpclose: %d,%d\n", TMSCTLR(dev), unit);
  	if(tmscpdebug)delay(10000L);
  #endif
! 	sc = &tmscp_softc[TMSCTLR(dev)];
! 	tms = sc->sc_drives[unit];
  	if (flag == FWRITE || (flag&FWRITE) && tms->tms_lastiow)
  		{
  		/*	   device, command, count */
***************
*** 668,674 ****
  	register int s;
  	int unit = TMSUNIT(dev);
  
! 	bp = &tmscp_softc[unit].sc_cmdbuf;
  
  	s = spl5();
  	while (bp->b_flags&B_BUSY)
--- 754,760 ----
  	register int s;
  	int unit = TMSUNIT(dev);
  
! 	bp = &tmscp_softc[TMSCTLR(dev)].sc_cmdbuf;
  
  	s = spl5();
  	while (bp->b_flags&B_BUSY)
***************
*** 723,731 ****
  	/* 
  	 * Figure out virtual address of message 
  	 * skip comm area and mscp messages header and previous messages
  	 */
! 	vaddr = (u_int)tmscomphys.b_un.b_addr | ((long)tmscomphys.b_xmem << 16);
! 	vaddr += (u_int)sc->sc_com - (u_int)tmscp;	/* unit offset */
  	vaddr += sizeof(struct tmscpca)			/* skip comm area */
  		+sizeof(struct mscp_header);		/* m_cmdref disp */
  	vaddr += offset * sizeof(struct mscp);		/* skip previous */
--- 809,819 ----
  	/* 
  	 * Figure out virtual address of message 
  	 * skip comm area and mscp messages header and previous messages
+ 	 *
+ 	 * N.B. Assumes SEG5 has been remapped to the comm area for this
+ 	 * controller.
  	 */
! 	vaddr = _iomap(tmscp[sc->sc_unit]);
  	vaddr += sizeof(struct tmscpca)			/* skip comm area */
  		+sizeof(struct mscp_header);		/* m_cmdref disp */
  	vaddr += offset * sizeof(struct mscp);		/* skip previous */
***************
*** 746,757 ****
  tmscpgetcp(sc)
  	register struct tmscp_softc *sc;
  {
! 	register struct mscp *mp;
  	struct tmscpca *cp;
  	register int i;
  	int	s;
  
  	s = spl5();
  	cp = &sc->sc_com->tmscp_ca;
  	/*
  	 * If no credits, can't issue any commands
--- 834,848 ----
  tmscpgetcp(sc)
  	register struct tmscp_softc *sc;
  {
! 	register struct mscp *mp = NULL;
  	struct tmscpca *cp;
  	register int i;
  	int	s;
+ 	segm seg5;
  
  	s = spl5();
+ 	saveseg5(seg5);
+ 	mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  	cp = &sc->sc_com->tmscp_ca;
  	/*
  	 * If no credits, can't issue any commands
***************
*** 773,786 ****
  		mp->mscp_buffer_h = mp->mscp_buffer_l = 0;
  		mp->mscp_zzz2 = 0;
  		sc->sc_lastcmd = (i + 1) % NCMD;
- 		(void) splx(s);
- 		return(mp);
  		}
  	(void) splx(s);
! 	return(NULL);
  }
  
- 
  /*
   * Initialize a TMSCP device.  Set up UBA mapping registers,
   * initialize data structures, and start hardware
--- 864,875 ----
  		mp->mscp_buffer_h = mp->mscp_buffer_l = 0;
  		mp->mscp_zzz2 = 0;
  		sc->sc_lastcmd = (i + 1) % NCMD;
  		}
+ 	restorseg5(seg5);
  	(void) splx(s);
! 	return(mp);
  }
  
  /*
   * Initialize a TMSCP device.  Set up UBA mapping registers,
   * initialize data structures, and start hardware
***************
*** 790,822 ****
  	register struct tmscp_softc *sc;
  {
  	register struct tmscpdevice *tmscpaddr;
! 	register int unit = sc - tmscp_softc;
! 	long comaddr, rap;
  
! 	sc->sc_ivec = TMSvec + unit * 4;
  	sc->sc_ctab.b_active++;
  	tmscpaddr = sc->sc_addr;
- 	if (tmscomphys.b_flags == 0)
- 		{
- 		/*
- 		 * Map or calculate the addresses (Qbus) of communications area
- 		 * and response packets
- 		 */
- 		rap = tmsphys((u_int)tmscp);
- 		tmscomphys.b_un.b_addr = (caddr_t)loint(rap);
- 		tmscomphys.b_xmem = hiint(rap);
- 		tmscomphys.b_bcount = sizeof (tmscp);
- 		tmscomphys.b_flags = B_PHYS;
- #ifdef	UNIBUS_MAP
- 		mapalloc(&tmscomphys);
- #endif
- 		comaddr = ((u_int)tmscomphys.b_un.b_addr | 
- 				((long)tmscomphys.b_xmem << 16)) +
- 				sizeof (struct tmscp) * unit +
- 				(u_int)RINGBASE;
- 		sc->sc_ctab.b_un.b_addr = (caddr_t)loint(comaddr);
- 		sc->sc_ctab.b_xmem = hiint(comaddr);
- 		}
  
  	/*
  	 * Start the hardware initialization sequence.
--- 879,892 ----
  	register struct tmscp_softc *sc;
  {
  	register struct tmscpdevice *tmscpaddr;
! 	long adr;
  
! 	sc->sc_ivec = TMSvec + sc->sc_unit * 4;
  	sc->sc_ctab.b_active++;
+ 	adr = _iomap(tmscp[sc->sc_unit]) + (u_int)RINGBASE;
+ 	sc->sc_ctab.b_un.b_addr = (caddr_t)loint(adr);
+ 	sc->sc_ctab.b_xmem = hiint(adr);
  	tmscpaddr = sc->sc_addr;
  
  	/*
  	 * Start the hardware initialization sequence.
***************
*** 841,847 ****
  	return(1);
  }
  
- 
  /*
   * Start I/O operation
   * This code is convoluted.  The majority of it was copied from the uda driver.
--- 911,916 ----
***************
*** 850,864 ****
  tmsstart(sc)
  	register struct tmscp_softc *sc;
  {
- 	register struct buf *bp, *dp;
  	register struct mscp *mp;
  	register struct tms_info *tms;
  	struct   tmscpdevice *tmscpaddr;
! 	struct   tmscp *tm;
! 	int i, unit = sc - tmscp_softc;
! 	char ioctl;		/* flag: set true if its an IOCTL command */
  
! 	tm = &tmscp[unit];
       for(;;)
  	{
  	if ((dp = sc->sc_ctab.b_actf) == NULL)
--- 919,932 ----
  tmsstart(sc)
  	register struct tmscp_softc *sc;
  {
  	register struct mscp *mp;
+ 	register struct buf *bp, *dp;
  	register struct tms_info *tms;
  	struct   tmscpdevice *tmscpaddr;
! 	int i;
! 	segm seg5;
  
!      saveseg5(seg5);		/* save just once at top */
       for(;;)
  	{
  	if ((dp = sc->sc_ctab.b_actf) == NULL)
***************
*** 883,896 ****
  		}
  	sc->sc_ctab.b_active++;
  	tmscpaddr = (struct tmscpdevice *)sc->sc_addr;
! 	tms = &tms_info[TMSUNIT(bp->b_dev)];
  	if ((tmscpaddr->tmscpsa&TMSCP_ERR) || sc->sc_state != S_RUN)
  		{
  		tprintf(tms->tms_ttyp,
! 		    "tms%d: hard error bn%ld\n",
! 		    minor(bp->b_dev)&03, bp->b_blkno);
! 		log(TMS_PRI, "tms%d: sa 0%o, state %d\n", unit,
! 				tmscpaddr->tmscpsa&0xffff, sc->sc_state);
  		(void)tkini(sc);
  		/* SHOULD REQUEUE OUTSTANDING REQUESTS, LIKE TMSCPRESET */
  		break;
--- 951,964 ----
  		}
  	sc->sc_ctab.b_active++;
  	tmscpaddr = (struct tmscpdevice *)sc->sc_addr;
! 	tms = sc->sc_drives[TMSUNIT(bp->b_dev)];
  	if ((tmscpaddr->tmscpsa&TMSCP_ERR) || sc->sc_state != S_RUN)
  		{
  		tprintf(tms->tms_ttyp,
! 		    "tms%d,%d: hard error bn%ld\n", sc->sc_unit,
! 		    TMSUNIT(bp->b_dev), bp->b_blkno);
! 		log(TMS_PRI, "tms%d,%d: sa 0%o, state %d\n", sc->sc_unit,
! 			TMSUNIT(bp->b_dev), tmscpaddr->tmscpsa, sc->sc_state);
  		(void)tkini(sc);
  		/* SHOULD REQUEUE OUTSTANDING REQUESTS, LIKE TMSCPRESET */
  		break;
***************
*** 900,938 ****
  	 * if a write command is done it will be detected in tmscprsp.
  	 */
  	tms->tms_lastiow = 0;
! 	if (tms->tms_online == 0)
  		{        /* not online */
  		if ((mp = tmscpgetcp(sc)) == NULL)
  			break;
  		mp->mscp_opcode = M_OP_ONLIN;
! 		mp->mscp_unit = 0;	/* ui->ui_slave; */
  		dp->b_active = 2;
  		sc->sc_ctab.b_actf = dp->b_forw; /* remove from controller q */
  		((Trl *)mp->mscp_dscptr)->hsh |= TMSCP_OWN|TMSCP_INT;
  		if (tmscpaddr->tmscpsa&TMSCP_ERR)
! 			printf("tms%d fatal error (0%o)\n", unit,
! 					tmscpaddr->tmscpsa);
  		i = tmscpaddr->tmscpip;
  		continue;
  		}
- 	/*
- 	 * If command is an ioctl command then set the ioctl flag for later use.
- 	 * If not (i.e. it is a read or write) then attempt
- 	 * to set up a buffer pointer.
- 	 */
- 	ioctl = 0;
- 	if (bp == &sc->sc_cmdbuf)
- 		ioctl = 1;
  	if ((mp = tmscpgetcp(sc)) == NULL)
  		break;
  	mp->mscp_cmdref = (u_short)bp;		/* pointer to get back */
! 	mp->mscp_unit = 0;	/* ui->ui_slave; */
  	/*
  	 * If its an ioctl-type command then set up the appropriate
  	 * tmscp command;  by doing a switch on the "b_resid" field where
  	 * the command mneumonic is stored.
  	 */
! 	if (ioctl)
  		{
  #ifdef TMSCP_DEBUG
  		printd("tmsstart: doing ioctl cmd %d\n", bp->b_resid);
--- 968,1001 ----
  	 * if a write command is done it will be detected in tmscprsp.
  	 */
  	tms->tms_lastiow = 0;
! 	if (tms->tms_online == -1)
  		{        /* not online */
  		if ((mp = tmscpgetcp(sc)) == NULL)
  			break;
+ 		mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  		mp->mscp_opcode = M_OP_ONLIN;
! 		mp->mscp_unit = TMSUNIT(bp->b_dev);
  		dp->b_active = 2;
  		sc->sc_ctab.b_actf = dp->b_forw; /* remove from controller q */
  		((Trl *)mp->mscp_dscptr)->hsh |= TMSCP_OWN|TMSCP_INT;
  		if (tmscpaddr->tmscpsa&TMSCP_ERR)
! 			printf("tms%d,%d fatal error 0%o\n", sc->sc_unit,
! 					TMSUNIT(bp->b_dev), tmscpaddr->tmscpsa);
! 		restorseg5(seg5);
  		i = tmscpaddr->tmscpip;
  		continue;
  		}
  	if ((mp = tmscpgetcp(sc)) == NULL)
  		break;
+ 	mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  	mp->mscp_cmdref = (u_short)bp;		/* pointer to get back */
! 	mp->mscp_unit = TMSUNIT(bp->b_dev);
  	/*
  	 * If its an ioctl-type command then set up the appropriate
  	 * tmscp command;  by doing a switch on the "b_resid" field where
  	 * the command mneumonic is stored.
  	 */
! 	if (bp == &sc->sc_cmdbuf)
  		{
  #ifdef TMSCP_DEBUG
  		printd("tmsstart: doing ioctl cmd %d\n", bp->b_resid);
***************
*** 1036,1042 ****
  			tms->tms_format = 0;
  			break;
  		default:
! 			printf("Bad ioctl on tms%d\n", unit);
  			/* Need a no-op. Reposition no amount */
  			mp->mscp_opcode = M_OP_REPOS;
  			break;
--- 1099,1106 ----
  			tms->tms_format = 0;
  			break;
  		default:
! 			printf("Bad ioctl on tms%d,%d\n", sc->sc_unit,
! 				TMSUNIT(bp->b_dev));
  			/* Need a no-op. Reposition no amount */
  			mp->mscp_opcode = M_OP_REPOS;
  			break;
***************
*** 1082,1088 ****
  	dp->av_back = bp;
  	if (tmscpaddr->tmscpsa&TMSCP_ERR)
  		{
! 		printf("tms%d: fatal error (0%o)\n",unit, tmscpaddr->tmscpsa);
  		(void)tkini(sc);
  		break;
  		}
--- 1146,1153 ----
  	dp->av_back = bp;
  	if (tmscpaddr->tmscpsa&TMSCP_ERR)
  		{
! 		printf("tms%d,%d: fatal error 0%o\n",sc->sc_unit, 
! 			TMSUNIT(bp->b_dev), tmscpaddr->tmscpsa);
  		(void)tkini(sc);
  		break;
  		}
***************
*** 1089,1114 ****
      }   /* end for */
      /*
       * Check for response ring transitions lost in the
!      * Race condition
       */
      for (i = sc->sc_lastrsp;; i++)
  	    {
  	    i %= NRSP;
! 	    if (tm->tmscp_ca.ca_rspdsc[i].hsh&TMSCP_OWN)
  		    break;
! 	    tmscprsp(unit, tm, sc, i);
! 	    tm->tmscp_ca.ca_rspdsc[i].hsh |= TMSCP_OWN;
  	    }
      sc->sc_lastrsp = i;
  }
  
  
  /*
!  * Process a response packet
   */
! tmscprsp(unit, tm, sc, i)
! 	int unit;
! 	register struct tmscp *tm;
  	register struct tmscp_softc *sc;
  	int i;
  {
--- 1154,1179 ----
      }   /* end for */
      /*
       * Check for response ring transitions lost in the
!      * Race condition.  Map SEG5 in case we escaped early from the for().
       */
+     mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
      for (i = sc->sc_lastrsp;; i++)
  	    {
  	    i %= NRSP;
! 	    if (sc->sc_com->tmscp_ca.ca_rspdsc[i].hsh&TMSCP_OWN)
  		    break;
! 	    tmscprsp(sc, i);
! 	    sc->sc_com->tmscp_ca.ca_rspdsc[i].hsh |= TMSCP_OWN;
  	    }
      sc->sc_lastrsp = i;
+     restorseg5(seg5);
  }
  
  
  /*
!  * Process a response packet.  N.B.  Assumes SEG5 maps comm area for controller
   */
! tmscprsp(sc, i)
  	register struct tmscp_softc *sc;
  	int i;
  {
***************
*** 1117,1123 ****
  	struct buf *dp, *bp;
  	int st;
  
! 	mp = &tm->tmscp_rsp[i];
  	mp->mscp_header.tmscp_msglen = mscp_msglen;
  	sc->sc_credits += mp->mscp_header.tmscp_credits & 0xf;  /* low 4 bits */
  	if ((mp->mscp_header.tmscp_credits & 0xf0) > 0x10)	/* Check */
--- 1182,1188 ----
  	struct buf *dp, *bp;
  	int st;
  
! 	mp = &sc->sc_com->tmscp_rsp[i];
  	mp->mscp_header.tmscp_msglen = mscp_msglen;
  	sc->sc_credits += mp->mscp_header.tmscp_credits & 0xf;  /* low 4 bits */
  	if ((mp->mscp_header.tmscp_credits & 0xf0) > 0x10)	/* Check */
***************
*** 1124,1129 ****
--- 1189,1195 ----
  		return;
  #ifdef TMSCP_DEBUG
  	printd("tmscprsp, opcode 0%o status 0%o\n",mp->mscp_opcode,mp->mscp_status&M_ST_MASK);
+ 	printd("  SEG5: 0%o sc: 0%o mp: 0%o i: %d\n",*KDSA5, sc, mp, i);
  #endif	
  	/*
  	 * If it's an error log message (datagram),
***************
*** 1131,1137 ****
  	 */
  	if ((mp->mscp_header.tmscp_credits & 0xf0) == 0x10)
  		{	/* check */
! 		tmserror(unit, (struct mslg *)mp);
  		return;
  		}
  	st = mp->mscp_status&M_ST_MASK;
--- 1197,1203 ----
  	 */
  	if ((mp->mscp_header.tmscp_credits & 0xf0) == 0x10)
  		{	/* check */
! 		tmserror(sc->sc_unit, (struct mslg *)mp);
  		return;
  		}
  	st = mp->mscp_status&M_ST_MASK;
***************
*** 1156,1164 ****
  		wakeup((caddr_t)&sc->sc_ctab);
  		return;
  		}
! 	if (mp->mscp_unit >= NTMS)
  		return;
! 	tms = &tms_info[unit];
  	/*
  	 * Save endcode, endflags, and status for mtioctl get unit status.
  	 * NOTE: Don't do this on Clear serious exception (reposition no-op);
--- 1222,1232 ----
  		wakeup((caddr_t)&sc->sc_ctab);
  		return;
  		}
! 	if (mp->mscp_unit >= 4)
  		return;
! 	tms = sc->sc_drives[mp->mscp_unit];
! 	if (!tms)		/* unopened unit coming online - ignore it */
! 		return;
  	/*
  	 * Save endcode, endflags, and status for mtioctl get unit status.
  	 * NOTE: Don't do this on Clear serious exception (reposition no-op);
***************
*** 1190,1207 ****
  			sc->sc_ctab.b_actl = dp;
  			tms->tms_online = 1;       /* mark it online */
  			tms->tms_dsize=(daddr_t)mp->mscp_maxwrt;
- #ifdef TMSCP_DEBUG
- 			printd("tmscprsp: unit %d online\n", mp->mscp_unit);
- #endif			
  			/* 
  			 * This define decodes the Media type identifier
  			 */
- #	        	define F_to_C(x,i)     ( ((x)->mscp_mediaid) >> (i*5+7) & 0x1f ? ( ( (((x)->mscp_mediaid) >>( i*5 + 7)) & 0x1f) + 'A' - 1): ' ')
  #ifdef TMSCP_DEBUG
! 			printd("tmscprsp: unit %d online %x %c%c %c%c%c%d\n"
! 				,mp->mscp_unit, mp->mscp_mediaid ,F_to_C(mp,4)
! 				,F_to_C(mp,3), F_to_C(mp,2)
! 				,F_to_C(mp,1), F_to_C(mp,0), mp->mscp_mediaid & 0x7f);
  #endif				
  			dp->b_active = 1;
  			}	/* end if st == M_ST_SUCC */
--- 1258,1270 ----
  			sc->sc_ctab.b_actl = dp;
  			tms->tms_online = 1;       /* mark it online */
  			tms->tms_dsize=(daddr_t)mp->mscp_maxwrt;
  			/* 
  			 * This define decodes the Media type identifier
  			 */
  #ifdef TMSCP_DEBUG
! 			printd("tmscprsp: %d,%d online mediaid 0x%lx format 0x%x\n",
! 				sc->sc_unit, mp->mscp_unit, mp->mscp_mediaid,
! 				mp->mscp_format);
  #endif				
  			dp->b_active = 1;
  			}	/* end if st == M_ST_SUCC */
***************
*** 1209,1219 ****
  			{
  			if (bp = dp->b_actf)
  				tprintf(tms->tms_ttyp,
! 				    "tms%d: hard error bn%ld: OFFLINE\n",
! 				    minor(bp->b_dev)&03, bp->b_blkno);
  			else
  				tprintf(tms->tms_ttyp,
! 				    "tms%d: hard error: OFFLINE\n", unit);
  			while (bp = dp->b_actf)
  				{
  				dp->b_actf = bp->av_forw;
--- 1272,1283 ----
  			{
  			if (bp = dp->b_actf)
  				tprintf(tms->tms_ttyp,
! 				    "tms%d,%d: hard error bn%ld: OFFLINE\n",
! 				    sc->sc_unit, mp->mscp_unit, bp->b_blkno);
  			else
  				tprintf(tms->tms_ttyp,
! 				    "tms%d,%d: hard error: OFFLINE\n", 
! 				    sc->sc_unit, mp->mscp_unit);
  			while (bp = dp->b_actf)
  				{
  				dp->b_actf = bp->av_forw;
***************
*** 1228,1238 ****
  	/*
  	 * The AVAILABLE ATTENTION message occurs when the
  	 * unit becomes available after loading,
! 	 * marking the unit offline (ui_flags = 0) will force an
  	 * online command prior to using the unit.
  	 */
  	case M_OP_AVATN:
! 		tms->tms_online = 0;
  		tms->tms_type = mp->mscp_mediaid;
  		break;
  	case M_OP_END:
--- 1292,1302 ----
  	/*
  	 * The AVAILABLE ATTENTION message occurs when the
  	 * unit becomes available after loading,
! 	 * marking the unit offline (tms_online = -1) will force an
  	 * online command prior to using the unit.
  	 */
  	case M_OP_AVATN:
! 		tms->tms_online = -1;
  		tms->tms_type = mp->mscp_mediaid;
  		break;
  	case M_OP_END:
***************
*** 1246,1253 ****
  		 * of 0200 instead of the 0241 (read) that was expected.
  		 */
  			
! 		printf("tms%d: invalid cmd, endcode = %o, status=%o\n",
! 			unit, mp->mscp_opcode, st);
  		bp = (struct buf *)mp->mscp_cmdref;
  		/*
  		 * Unlink buffer from I/O wait queue.
--- 1310,1318 ----
  		 * of 0200 instead of the 0241 (read) that was expected.
  		 */
  			
! 		printf("tms%d,%d: invalid cmd, endcode = %o, status=%o\n",
! 			sc->sc_unit, mp->mscp_unit, mp->mscp_opcode, st);
! common:	/* GTUNT finishes up thru here too */
  		bp = (struct buf *)mp->mscp_cmdref;
  		/*
  		 * Unlink buffer from I/O wait queue.
***************
*** 1272,1279 ****
  	 * issued.  For the ioctl, "rewoffl", a tmscp AVAILABLE command is
  	 * done with the UNLOAD modifier.  This performs a rewind, followed
  	 * by marking the unit offline.  So mark the unit offline
! 	 * software wise as well (ui_flags = 0 and 
! 	 * tms->tms_openf = 0).
  	 */
  	case M_OP_AVAIL|M_OP_END:
  #ifdef TMSCP_DEBUG
--- 1337,1343 ----
  	 * issued.  For the ioctl, "rewoffl", a tmscp AVAILABLE command is
  	 * done with the UNLOAD modifier.  This performs a rewind, followed
  	 * by marking the unit offline.  So mark the unit offline
! 	 * software wise as well (tms->tms_online = -1 and tms_open = 0).
  	 */
  	case M_OP_AVAIL|M_OP_END:
  #ifdef TMSCP_DEBUG
***************
*** 1289,1295 ****
  		dp->b_qsize--;
  		if (st == M_ST_OFFLN || st == M_ST_AVLBL)
  			{
! 			tms->tms_online = 0;       /* mark unit offline */
  			tms->tms_openf = 0;
  			tms->tms_type = mp->mscp_mediaid;
  			/*
--- 1353,1359 ----
  		dp->b_qsize--;
  		if (st == M_ST_OFFLN || st == M_ST_AVLBL)
  			{
! 			tms->tms_online = -1;       /* mark unit offline */
  			tms->tms_openf = 0;
  			tms->tms_type = mp->mscp_mediaid;
  			/*
***************
*** 1320,1329 ****
  			if (st != M_ST_TAPEM)
  				{
  				tprintf(tms->tms_ttyp,
! 				    "tms%d: hard error bn%ld\n",minor(bp->b_dev)&03, bp->b_blkno);
! 				tprintf(tms->tms_ttyp, "status:0%o flags:0%o\n",
! 				     (mp->mscp_status & 177740)>>5, mp->mscp_flags);
! 				errinfo(st);		/* produces more info */
  				bp->b_flags |= B_ERROR;
  				}
  			else
--- 1384,1392 ----
  			if (st != M_ST_TAPEM)
  				{
  				tprintf(tms->tms_ttyp,
! 				"tms%d,%d: hard error bn%ld status:0%o flags:0%o\n",
! 				    sc->sc_unit, mp->mscp_unit, bp->b_blkno,
! 				    mp->mscp_status >> 5, mp->mscp_flags);
  				bp->b_flags |= B_ERROR;
  				}
  			else
***************
*** 1349,1450 ****
  	case M_OP_GTUNT|M_OP_END:
  #ifdef TMSCP_DEBUG
  		printd("tmscprsp: GTUNT end packet status = 0%o\n",st);
! 		printd("tmscprsp: unit %d mediaid %x %c%c %c%c%c%d %x %x t=%d\n"
! 		    ,mp->mscp_unit, mp->mscp_mediaid
! 		    ,F_to_C(mp,4),F_to_C(mp,3),F_to_C(mp,2)
! 		    ,F_to_C(mp,1),F_to_C(mp,0)
! 		    ,mp->mscp_mediaid & 0x7f
  		    ,mp->mscp_unitid.val[0]
  		    ,mp->mscp_unitid.val[1]
  		    ,mp->mscp_format);
! #endif		
  		tms->tms_type = mp->mscp_mediaid;
  		tms->tms_fmtmenu = mp->mscp_fmtmenu;
  		tms->tms_unitflgs = mp->mscp_unitflgs;
! 		break;
  
  	default:
! 		printf("tms unknown packet\n");
! 		tmserror(unit, (struct mslg *)mp);
  	}	/* end switch mp->mscp_opcode */
  }
  
- 
- /* 
-  * Give a meaningful error when the mscp_status field returns an error code.
-  */
- 
- errinfo(st)
- 	int st;			/* the status code */
- {
- 	switch(st) {
- 	case M_ST_ICMD:
- 		printf("invalid command\n");
- 		break;
- 	case M_ST_ABRTD:
- 		printf("command aborted\n");
- 		break;
- 	case M_ST_OFFLN:
- 		printf("unit offline\n");
- 		break;
- 	case M_ST_WRTPR:
- 		printf("unit write protected\n");
- 		break;
- 	case M_ST_COMP:
- 		printf("compare error\n");
- 		break;
- 	case M_ST_DATA:
- 		printf("data error\n");
- 		break;
- 	case M_ST_HSTBF:
- 		printf("host buffer access error\n");
- 		break;
- 	case M_ST_CNTLR:
- 		printf("controller error\n");
- 		break;
- 	case M_ST_DRIVE:
- 		printf("drive error\n");
- 		break;
- 	case M_ST_FMTER:
- 		printf("formatter error\n");
- 		break;
- 	case M_ST_BOT:
- 		printf("BOT encountered\n");
- 		break;
- 	case M_ST_TAPEM:
- 		printf("tape mark encountered\n");
- 		break;
- 	case M_ST_RDTRN:
- 		printf("record data truncated\n");
- 		break;
- 	case M_ST_PLOST:
- 		printf("position lost\n");
- 		break;
- 	case M_ST_SEX:
- 		printf("serious exception\n");
- 		break;
- 	case M_ST_LED:
- 		printf("LEOT detected\n");
- 		break;
- 	}
- }
- 
  /*
-  * 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
- tmsphys(vaddr)
- 	register	unsigned	vaddr;
- {
- 	register	unsigned	click;
- 
- 	click = (sep_id ? KDSA0 : KISA0)[(vaddr >> 13) & 07];
- 	return(((long)click << 6) + (vaddr & 017777));
- }
- 
- /*
   * Manage buffers and perform block mode read and write operations.
   */
  
--- 1412,1435 ----
  	case M_OP_GTUNT|M_OP_END:
  #ifdef TMSCP_DEBUG
  		printd("tmscprsp: GTUNT end packet status = 0%o\n",st);
! 		printd("tmscprsp: %d,%d mediaid 0x%lx %x %x format=%d\n",
! 		    sc->sc_unit,mp->mscp_unit, mp->mscp_mediaid
  		    ,mp->mscp_unitid.val[0]
  		    ,mp->mscp_unitid.val[1]
  		    ,mp->mscp_format);
! #endif
  		tms->tms_type = mp->mscp_mediaid;
  		tms->tms_fmtmenu = mp->mscp_fmtmenu;
  		tms->tms_unitflgs = mp->mscp_unitflgs;
! 		goto common;	/* need to dequeue buffer and do iodone() */
  
  	default:
! 		printf("tms %d,%d unknown packet\n", sc->sc_unit,mp->mscp_unit);
! 		tmserror(sc->sc_unit, (struct mslg *)mp);
  	}	/* end switch mp->mscp_opcode */
  }
  
  /*
   * Manage buffers and perform block mode read and write operations.
   */
  
***************
*** 1454,1479 ****
  	register struct buf *dp;
  	register struct tmscp_softc *sc;
  	struct	tms_info *tms;
! 	int unit = TMSUNIT(bp->b_dev);
  	int s;
  
! 	if (unit >= NTMS)
  		{
- #ifdef TMSCP_DEBUG
- 		printd ("tmscpstrategy: bad unit # %d\n",unit);
- #endif
  		bp->b_flags |= B_ERROR;
  		iodone(bp);
  		return;
  		}
- 	sc = &tmscp_softc[unit];
- 	tms = &tms_info[unit];
- 	if (tms->tms_online == 0)
- 		{
- 		bp->b_flags |= B_ERROR;
- 		iodone(bp);
- 		return;
- 		}
  #ifdef	UNIBUS_MAP
  	mapalloc(bp);
  #endif
--- 1439,1455 ----
  	register struct buf *dp;
  	register struct tmscp_softc *sc;
  	struct	tms_info *tms;
! 	int ctlr = TMSCTLR(bp->b_dev);
  	int s;
  
! 	sc = &tmscp_softc[ctlr];
! 	tms = sc->sc_drives[TMSUNIT(bp->b_dev)];
! 	if (!tms || tms->tms_online != 1)
  		{
  		bp->b_flags |= B_ERROR;
  		iodone(bp);
  		return;
  		}
  #ifdef	UNIBUS_MAP
  	mapalloc(bp);
  #endif
***************
*** 1526,1555 ****
  	register struct	mscp	*mp;
  	daddr_t bn, dumpsize;
  	long paddr, maddr;
! 	int unit, count;
  	struct	ubmap *ubp;
  
! 	unit = TMSUNIT(dev);
! 	if (unit >= NTMS)
  		return (ENXIO);
! 	sc = &tmscp_softc[unit];
  	tmscpaddr = sc->sc_addr;
  	if (tmscpaddr == NULL)
  		return(ENXIO);
  
  #ifdef	UNIBUS_MAP
  	if (ubmap) {
  		ubp = UBMAP;
! 		ubp->ub_lo = loint(tmscomphys.b_un.b_addr);
! 		ubp->ub_hi = hiint(tmscomphys.b_xmem);
! 		tmscomphys.b_un.b_addr = NULL;
! 		tmscomphys.b_xmem = 0;
  	}
  #endif
! 	paddr = (u_int)tmscomphys.b_un.b_addr +
! 			((long)tmscomphys.b_xmem << 16) +
! 			(u_int)RINGBASE;
! 	sc->sc_com = tmscp;
  	mp = sc->sc_com->tmscp_rsp;
  	sc->sc_com->tmscp_ca.ca_cmdint = sc->sc_com->tmscp_ca.ca_rspint = 0;
  	bzero(mp, 2 * sizeof (*mp));
--- 1502,1529 ----
  	register struct	mscp	*mp;
  	daddr_t bn, dumpsize;
  	long paddr, maddr;
! 	int unit = TMSUNIT(dev), count, ctlr = TMSCTLR(dev);
  	struct	ubmap *ubp;
+ 	segm seg5;
  
! 	if (ctlr >= NTMSCP)
  		return (ENXIO);
! 	sc = &tmscp_softc[ctlr];
  	tmscpaddr = sc->sc_addr;
  	if (tmscpaddr == NULL)
  		return(ENXIO);
  
+ 	paddr = _iomap(tmscp[sc->sc_unit]);
  #ifdef	UNIBUS_MAP
  	if (ubmap) {
  		ubp = UBMAP;
! 		ubp->ub_lo = loint(paddr);
! 		ubp->ub_hi = hiint(paddr);
  	}
  #endif
! 	paddr += RINGBASE;
! 	saveseg5(seg5);
! 	mapseg5(tmscp[sc->sc_unit], MAPBUFDESC);
  	mp = sc->sc_com->tmscp_rsp;
  	sc->sc_com->tmscp_ca.ca_cmdint = sc->sc_com->tmscp_ca.ca_rspint = 0;
  	bzero(mp, 2 * sizeof (*mp));
***************
*** 1573,1579 ****
  	if (tmscpcmd(M_OP_STCON, unit, sc) == 0) {
  		return(EFAULT);
  	}
! 	sc->sc_com->tmscp_cmd[0].mscp_unit = 0;		/* ui->ui_slave */
  	if (tmscpcmd(M_OP_ONLIN, unit, sc) == 0) {
  		return(EFAULT);
  	}
--- 1547,1553 ----
  	if (tmscpcmd(M_OP_STCON, unit, sc) == 0) {
  		return(EFAULT);
  	}
! 	sc->sc_com->tmscp_cmd[0].mscp_unit = unit;
  	if (tmscpcmd(M_OP_ONLIN, unit, sc) == 0) {
  		return(EFAULT);
  	}
***************
*** 1604,1609 ****
--- 1578,1584 ----
  		return(EIO);
  	paddr += (DBSIZE << PGSHIFT);
  	}
+ 	restorseg5(seg5);
  	return (0);
  }
  
***************
*** 1625,1637 ****
  	rlp = &sc->sc_com->tmscp_ca.ca_rspdsc[0];
  
  	cmp->mscp_opcode = op;
! 	cmp->mscp_unit = 0;		/* unit? */
  	cmp->mscp_header.tmscp_msglen = mscp_msglen;
  	rmp->mscp_header.tmscp_msglen = mscp_msglen;
  	rlp[0].hsh |= TMSCP_OWN|TMSCP_INT;
  	rlp[1].hsh |= TMSCP_OWN|TMSCP_INT;
  	if (sc->sc_addr->tmscpsa&TMSCP_ERR)
! 		printf("tms fatal error (0%o)\n", sc->sc_addr->tmscpsa);
  	i = sc->sc_addr->tmscpip;
  
  	while ((rlp[1].hsh & TMSCP_INT) == 0)
--- 1600,1613 ----
  	rlp = &sc->sc_com->tmscp_ca.ca_rspdsc[0];
  
  	cmp->mscp_opcode = op;
! 	cmp->mscp_unit = unit;
  	cmp->mscp_header.tmscp_msglen = mscp_msglen;
  	rmp->mscp_header.tmscp_msglen = mscp_msglen;
  	rlp[0].hsh |= TMSCP_OWN|TMSCP_INT;
  	rlp[1].hsh |= TMSCP_OWN|TMSCP_INT;
  	if (sc->sc_addr->tmscpsa&TMSCP_ERR)
! 		printf("tms%d,%d fatal error 0%o\n", sc->sc_unit, unit,
! 			sc->sc_addr->tmscpsa);
  	i = sc->sc_addr->tmscpip;
  
  	while ((rlp[1].hsh & TMSCP_INT) == 0)
***************
*** 1644,1650 ****
  	if (rmp->mscp_opcode != (op|M_OP_END) ||
  	    (rmp->mscp_status&M_ST_MASK) != M_ST_SUCC)
  		{
! 		printf("error: com %d opc 0x%x stat 0x%x\ndump ", op,
  			rmp->mscp_opcode, rmp->mscp_status);
  		return(0);
  		}
--- 1620,1626 ----
  	if (rmp->mscp_opcode != (op|M_OP_END) ||
  	    (rmp->mscp_status&M_ST_MASK) != M_ST_SUCC)
  		{
! 		printf("err: com %d opc 0x%x stat 0x%x\ndump ", op,
  			rmp->mscp_opcode, rmp->mscp_status);
  		return(0);
  		}
***************
*** 1652,1689 ****
  }
  #endif TMSCP_DUMP
  
! /*
!  * Perform raw read
!  */
  
  tmscpread(dev, uio)
! 	dev_t dev;
  	struct uio *uio;
  {
! 	register int unit = TMSUNIT(dev);
! 
! 	if (unit >= NTMS)
! 		return (ENXIO);
! 	return (physio(tmscpstrategy, &tms_info[unit].tms_rtab, dev, B_READ, BYTE, uio));
  }
  
- 
- /*
-  * Perform raw write
-  */
- 
  tmscpwrite(dev, uio)
! 	dev_t dev;
  	struct uio *uio;
  {
! 	register int unit = TMSUNIT(dev);
! 
! 	if (unit >= NTMS)
! 		return (ENXIO);
! 	return (physio(tmscpstrategy, &tms_info[unit].tms_rtab, dev, B_WRITE, BYTE, uio));
  }
  
- 
  /*
   * Catch ioctl commands, and call the "command" routine to do them.
   */
--- 1628,1656 ----
  }
  #endif TMSCP_DUMP
  
! struct buf *
! tmsrtab(dev)
! 	register dev_t dev;
! {
! 	register struct tmscp_softc *sc = &tmscp_softc[TMSCTLR(dev)];
  
+ 	return(&sc->sc_drives[TMSUNIT(dev)]->tms_rtab);
+ }
+ 
  tmscpread(dev, uio)
! 	register dev_t dev;
  	struct uio *uio;
  {
! 	return(physio(tmscpstrategy, tmsrtab(dev), dev, B_READ, BYTE, uio));
  }
  
  tmscpwrite(dev, uio)
! 	register dev_t dev;
  	struct uio *uio;
  {
! 	return(physio(tmscpstrategy, tmsrtab(dev), dev, B_WRITE, BYTE, uio));
  }
  
  /*
   * Catch ioctl commands, and call the "command" routine to do them.
   */
***************
*** 1695,1701 ****
  	caddr_t data;
  	int flag;
  {
! 	register struct buf *bp = &tmscp_softc[TMSUNIT(dev)].sc_cmdbuf;
  	register callcount;	/* number of times to call cmd routine */
  	register struct tms_info *tms;
  	int fcount;		/* number of files (or records) to space */
--- 1662,1669 ----
  	caddr_t data;
  	int flag;
  {
! 	struct tmscp_softc *sc = &tmscp_softc[TMSCTLR(dev)];
! 	register struct buf *bp = &sc->sc_cmdbuf;
  	register callcount;	/* number of times to call cmd routine */
  	register struct tms_info *tms;
  	int fcount;		/* number of files (or records) to space */
***************
*** 1747,1753 ****
  		/*
  		 * Return status info associated with the particular UNIT.
  		 */
! 		tms = &tms_info[TMSUNIT(dev)];
  		mtget = (struct mtget *)data;
  		mtget->mt_type = MT_ISTMSCP;
  		mtget->mt_dsreg = tms->tms_flags << 8;
--- 1715,1723 ----
  		/*
  		 * Return status info associated with the particular UNIT.
  		 */
! 		tms = sc->sc_drives[TMSUNIT(dev)];
! 		if (!tms)
! 			return(ENXIO);
  		mtget = (struct mtget *)data;
  		mtget->mt_type = MT_ISTMSCP;
  		mtget->mt_dsreg = tms->tms_flags << 8;
***************
*** 1770,1777 ****
   * send message to an error logger.
   */
  
! tmserror(unit, mp)
! 	register int unit;
  	register struct mslg *mp;
  {
  	register i;
--- 1740,1747 ----
   * send message to an error logger.
   */
  
! tmserror(ctlr, mp)
! 	register int ctlr;
  	register struct mslg *mp;
  {
  	register i;
***************
*** 1780,1803 ****
  	printd("tmserror:\n");
  #endif
  	if(!(mp->mslg_flags & (M_LF_SUCC | M_LF_CONT)))
! 		log(TMS_PRI, "tms%d: %s error, ", unit,
  		mp->mslg_flags & ( M_LF_SUCC | M_LF_CONT ) ? "soft" : "hard");
  
  	switch (mp->mslg_format) {
  
  	case M_FM_CNTERR:
! 		log(TMS_PRI, "controller error, event 0%o\n", mp->mslg_event);
  		break;
  	case M_FM_BUSADDR:
! 		log(TMS_PRI, "host memory access error, event 0%o, addr 0%o\n",
  			mp->mslg_event, mp->mslg_busaddr);
  		break;
  	case M_FM_TAPETRN:
! 		log(TMS_PRI, "tape transfer error, unit %d, grp 0x%x, event 0%o\n",
  			mp->mslg_unit, mp->mslg_group, mp->mslg_event);
  		break;
  	case M_FM_STIERR:
! 		log(TMS_PRI, "STI error, unit %d, event 0%o\n",
  			mp->mslg_unit, mp->mslg_event);
  #ifdef notdef
  		/* too painful to do with log() */
--- 1750,1773 ----
  	printd("tmserror:\n");
  #endif
  	if(!(mp->mslg_flags & (M_LF_SUCC | M_LF_CONT)))
! 		log(TMS_PRI, "tms%d,%d: %s err, ", ctlr, mp->mslg_unit,
  		mp->mslg_flags & ( M_LF_SUCC | M_LF_CONT ) ? "soft" : "hard");
  
  	switch (mp->mslg_format) {
  
  	case M_FM_CNTERR:
! 		log(TMS_PRI, "ctlr err, event 0%o\n", mp->mslg_event);
  		break;
  	case M_FM_BUSADDR:
! 		log(TMS_PRI, "host memory access err, event 0%o, addr 0%o\n",
  			mp->mslg_event, mp->mslg_busaddr);
  		break;
  	case M_FM_TAPETRN:
! 		log(TMS_PRI, "tape transfer err, unit %d, grp 0x%x, event 0%o\n",
  			mp->mslg_unit, mp->mslg_group, mp->mslg_event);
  		break;
  	case M_FM_STIERR:
! 		log(TMS_PRI, "STI err, unit %d, event 0%o\n",
  			mp->mslg_unit, mp->mslg_event);
  #ifdef notdef
  		/* too painful to do with log() */
***************
*** 1815,1822 ****
  			mp->mslg_unit, mp->mslg_event);
  		break;
  	default:
! 		log(TMS_PRI, "unknown error, unit %d, format 0%o, event 0%o\n",
! 			mp->mslg_unit, mp->mslg_format, mp->mslg_event);
  	}
  
  	if (tmscperror)
--- 1785,1792 ----
  			mp->mslg_unit, mp->mslg_event);
  		break;
  	default:
! 		log(TMS_PRI, "unknown err, %d,%d, format 0%o, event 0%o\n",
! 			ctlr,mp->mslg_unit, mp->mslg_format, mp->mslg_event);
  	}
  
  	if (tmscperror)
***************
*** 1828,1849 ****
  		printf("\n");
  		}
  }
! 
! #ifdef	notSMS
! tprintf(pri,fmt,a)
! 	int pri;
! 	char *fmt;
! 	unsigned a;
! 	{
! 	prf(fmt, &a, 5);	/* 5 = TOLOG|TOCONSOLE */
! 	}
! 
! log(pri,fmt,a)
! 	int pri;
! 	char *fmt;
! 	unsigned a;
! 	{
! 	prf(fmt, &a, 5);
! 	}
! #endif	notSMS
! #endif
--- 1798,1801 ----
  		printf("\n");
  		}
  }
! #endif NTMSCP

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 14 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 14 of 22

The [T]MSCP arena is added in to the estimated system memory 
requirements.  The memory requirements calculation was overflowing
due to 'long' vs. 'int' problems, resulting in megabyte size estimates 
for the system - this was fixed.

*** /usr/src/sys/conf/checksys.c.old	Thu May 31 15:18:19 1990
--- /usr/src/sys/conf/checksys.c	Sat Mar 30 21:39:12 1991
***************
*** 37,42 ****
--- 37,43 ----
  #define	N_XITDESC	18
  #define	N_QUOTDESC	19
  #define	N_NAMECACHE	20
+ #define	N_IOSIZE	21
  
  struct nlist nl[] = {
  	{ "_end" },			/*  0 */
***************
*** 60,65 ****
--- 61,67 ----
  	{ "_xitdesc" },			/* 18 */
  	{ "_quotdes" },			/* 19 */
  	{ "_namecac" },			/* 20 */
+ 	{ "__iosize" },			/* 21 */
  	{ "" },
  };
  
***************
*** 223,229 ****
  			if (nl[N_END].n_value < 0120000)
  				printf("Data ends %u bytes below the remapping area (0120000-0140000, KDSD5)\nyou may define NOKA5.\n", 0120000 - nl[N_END].n_value);
  		}
! 	totsize += cround(getval(N_NBUF) * getval(N_BSIZE));
  	if (nl[N_CLIST].n_value)
  		totsize += cround(getval(N_CLIST) * (long)sizeof(struct cblock));
  	if (nl[N_RAM].n_type)
--- 225,231 ----
  			if (nl[N_END].n_value < 0120000)
  				printf("Data ends %u bytes below the remapping area (0120000-0140000, KDSD5)\nyou may define NOKA5.\n", 0120000 - nl[N_END].n_value);
  		}
! 	totsize += (getval(N_NBUF) * getval(N_BSIZE));
  	if (nl[N_CLIST].n_value)
  		totsize += cround(getval(N_CLIST) * (long)sizeof(struct cblock));
  	if (nl[N_RAM].n_type)
***************
*** 234,239 ****
--- 236,243 ----
  		totsize += (ninode * 3 * sizeof (long));
  	if (nl[N_NAMECACHE].n_type)
  		totsize += (ninode * sizeof(struct namecache));
+ 	if (nl[N_IOSIZE].n_type)
+ 		totsize += getval(N_IOSIZE);
  	totsize += ctob(USIZE);
  	printf("System will occupy %ld bytes of memory (including buffers and clists).\n", totsize);
  	for (i = 0;nl[i].n_name[0];++i) {
***************
*** 260,266 ****
  
  	if ((nl[indx].n_type&N_TYPE) == N_BSS)
  		return((long)0);
! 	offst = nl[indx].n_value + obj.a_text + sizeof(obj);
  	if (obj.a_magic == A_MAGIC2 || obj.a_magic == A_MAGIC5)
  		offst -= (off_t)round(obj.a_text);
  	if (obj.a_magic == A_MAGIC5 || obj.a_magic == A_MAGIC6) {
--- 264,272 ----
  
  	if ((nl[indx].n_type&N_TYPE) == N_BSS)
  		return((long)0);
! 	offst = nl[indx].n_value;
! 	offst += obj.a_text;
! 	offst += sizeof(obj);
  	if (obj.a_magic == A_MAGIC2 || obj.a_magic == A_MAGIC5)
  		offst -= (off_t)round(obj.a_text);
  	if (obj.a_magic == A_MAGIC5 || obj.a_magic == A_MAGIC6) {

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 15 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 15 of 22

The setup documentation was updated to reflect the fact that the
xp driver (in both the GENERIC kernel and standalone utilities)
prints the xptype address now.  This prevents the use of obsolete/wrong
information from the hardcopy documents if the address changes due
to rebuilding the GENERIC kernel.

*** /usr/doc/2.10/setup.2.11/2.t.old	Wed Dec 19 09:48:28 1990
--- /usr/doc/2.10/setup.2.11/2.t	Sat May  4 20:35:36 1991
***************
*** 2,8 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)2.t	1.0 (Contel) 7/5/90
  .\"
  .ds lq ``
  .ds rq ''
--- 2,8 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)2.t	1.1 (Contel) 5/4/91
  .\"
  .ds lq ``
  .ds rq ''
***************
*** 79,84 ****
--- 79,88 ----
  sure that the write ring is not inserted.
  Then use the normal bootstrap ROM, console monitor or other
  bootstrap to boot from the tape.
+ .PP
+ NOTE: The boot blocks expect the CSR of the booting controller in r0
+ and the unit number in r1.
+ .PP
  If no other means are available, the following code can be keyed in
  and executed at (say) 0100000 to boot from a TM tape drive (the magic number
  172526 is the address of the TM-11 current memory address register;
***************
*** 87,97 ****
  .DS
  .TS
  l l.
  012700	(mov $172526, r0)
  172526
  010040	(mov r0, -(r0))
  012740	(mov $60003, -(r0))
! 060003
  000777	(br .)
  .TE
  .DE
--- 91,103 ----
  .DS
  .TS
  l l.
+ 012700  (mov $unit, r1)
+ 000000    (normally unit 0)
  012700	(mov $172526, r0)
  172526
  010040	(mov r0, -(r0))
  012740	(mov $60003, -(r0))
! 060003    (if unit 1 use 060403, etc)
  000777	(br .)
  .TE
  .DE
***************
*** 126,141 ****
  94	94	+	+
  .TE
  .DE
- The bootstrap can be forced to set up the machine for a different
- class of PDP-11 by placing an appropriate value in the console switch register
- (if there is one) while booting it.
- The value to use is the PDP-11 class, interpreted as an \fIoctal\fP number
- (use, for example, 070 for an 11/70).
- \fBWarning:\fP  some old DEC bootstraps use the switch
- register to indicate where to boot from.
- On such machines, if the value in the switch register indicates
- an incorrect CPU, be sure to reset the switches immediately after
- initiating the tape bootstrap.
  .PP
  You are now talking to the tape bootstrap monitor.
  At any point in the following procedure you can return
--- 132,137 ----
***************
*** 155,161 ****
  Disk	Root File System Size
  	  (1K-byte blocks)
  
! br	9120 (T300)
  hk	4158\(ua
  ra	7942 (RA60/80/81/82, RD54, RC25)
  	4850 (RD51/52/53)
--- 151,157 ----
  Disk	Root File System Size
  	  (1K-byte blocks)
  
! br	9120 (T300 - not in the GENERIC kernel)
  hk	4158\(ua
  ra	7942 (RA60/80/81/82, RD54, RC25)
  	4850 (RD51/52/53)
***************
*** 199,205 ****
  072	Ampex Capricorn
  073	SI, CDC 9775 (direct)
  074	SI 6100, Fuji Eagle 2351A
! 075	Emulex SC01B or SI 9400, Fuji 160
  076	Emulex SC-21, Ampex 815 cylinder RM05
  077	Diva Comp V, Ampex 9300
  .TE
--- 195,201 ----
  072	Ampex Capricorn
  073	SI, CDC 9775 (direct)
  074	SI 6100, Fuji Eagle 2351A
! 075	Emulex SC01B/SC03B or SI 9400, Fuji 160 (in RM80 mode)
  076	Emulex SC-21, Ampex 815 cylinder RM05
  077	Diva Comp V, Ampex 9300
  .TE
***************
*** 207,228 ****
  Check the drive type number in your controller manual,
  or halt the CPU and examine this register.
  If the value does not correspond to the actual drive type,
! you must place the correct value in the switch
! register after the tape bootstrap is running
! and before any attempt is made to access the drive.
  This will override the drive type register.
  This value must be present at the time each program
  (including the bootstrap itself) first tries to access the disk.
! On machines without a switch register, the \fIxptype\fP 
! variable can be patched in memory.  After starting each utility
  but before accessing the disk, halt the CPU, place the new drive type
! number at the proper memory location with the console switches or monitor,
! and then continue.  The location of \fIxptype\fP in each utility is
! .\"CHECK - XXX
! mkfs:  034146, restor:  040054, icheck:  035002 and boot:  0634640
! (the location for boot is higher because it relocates itself).
  Once UNIX itself is booted (see section ``\fBStep 4: booting UNIX\fP'') you must
! patch it also.
  .PP
  Finally, determine the proper interleaving factors \fIm\fP and \fIn\fP
  for your disk and CPU combination from the following table.
--- 203,225 ----
  Check the drive type number in your controller manual,
  or halt the CPU and examine this register.
  If the value does not correspond to the actual drive type,
! you must patch the \fIxptype\fP variable in memory
! before any attempt is made to access the drive.
  This will override the drive type register.
  This value must be present at the time each program
  (including the bootstrap itself) first tries to access the disk.
! After starting each utility
  but before accessing the disk, halt the CPU, place the new drive type
! number at the proper memory location using the front panel or monitor
! and then continue.  The address of \fIxptype\fP in each utility is
! printed out on the console the first time the disc is accessed.
! Because \fBboot\fP relocates itself you must remember to add 0600000 
! to the address of \fIxptype\fP.
! .PP
  Once UNIX itself is booted (see section ``\fBStep 4: booting UNIX\fP'') you must
! patch it also.  The \fIxp\fP driver in the \fBGENERIC\fP kernel prints to
! the console the address of \fIxp_drive\fP and \fIxp_controller\fP and delays
! for about 10 seconds.
  .PP
  Finally, determine the proper interleaving factors \fIm\fP and \fIn\fP
  for your disk and CPU combination from the following table.
***************
*** 382,397 ****
  \fBNote:\fP If you are booting from an \fIxp\fP with a drive type
  that is not recognized, it will be necessary to patch the system before
  it first accesses the root file system.
! Halt the processor after it
! has begun printing the version string but before it has finished printing
! the ``mem = ...'' strings.
  Place the drive type number corresponding to your drive
! .\"CHECK - XXX
! at location 010622;
! the address for
! the first controller's CSR is 046552.
  If you plan to use any drives other than 0 before you recompile
! the system, you should patch these locations.
  Make the patches and continue the CPU.
  The value before patching must be zero.  If it is not, you have halted too
  late and should try again.
--- 379,399 ----
  \fBNote:\fP If you are booting from an \fIxp\fP with a drive type
  that is not recognized, it will be necessary to patch the system before
  it first accesses the root file system.
! The \fBGENERIC\fP kernel \fIxp\fP driver prints out the addresses of
! \fIxp_drive\fP and \fIxp_controller\fP and then delays for 10 seconds
! (approximately).
! Halt the processor after it has printed out the addresses
! but before the disk has been accessed.
! .PP
  Place the drive type number corresponding to your drive
! at the address of \fIxp_drive\fP plus 2.  Modify only the low byte, the
! high byte is the drive unit number.
! The address for the first controller's CSR is \fIxp_controller\fP plus 4.
! It should be noted that at present the kernel may only be booted from a
! controller at the standard/first CSR.
  If you plan to use any drives other than 0 before you recompile
! the system, you should patch the location for those drives.  The \fIxp_drive\fP
! structure in the \fBGENERIC\fP kernel is 012 bytes long.
  Make the patches and continue the CPU.
  The value before patching must be zero.  If it is not, you have halted too
  late and should try again.
***************
*** 461,467 ****
  l l l.
  boot	driver	devices
  _
! bruboot	br	Contel BR1538/BR1711
  hkuboot	hk	RK06/07
  rauboot	ra	RA60/80/81/82, RC25, RD51/52/53/54, RX50
  rkuboot	rk	RK05
--- 463,469 ----
  l l l.
  boot	driver	devices
  _
! bruboot	br	Contel BR1538/BR1711 (not in the \fBGENERIC\fP kernel)
  hkuboot	hk	RK06/07
  rauboot	ra	RA60/80/81/82, RC25, RD51/52/53/54, RX50
  rkuboot	rk	RK05
***************
*** 472,478 ****
  rm03uboot	xp	RM02/03
  rm05uboot	xp	RM05 or SI 9500, CDC 9766
  si51uboot	xp	SI 6100, Fujitsu Eagle 2351A
! si94uboot	xp	Emulex SC01B or SI 9400, Fujitsu 160
  .TE
  .DE
  Once this is done, booting from this disk will load and execute the block
--- 474,480 ----
  rm03uboot	xp	RM02/03
  rm05uboot	xp	RM05 or SI 9500, CDC 9766
  si51uboot	xp	SI 6100, Fujitsu Eagle 2351A
! si94uboot	xp	Emulex SC01B/SC03B or SI 9400, Fujitsu 160
  .TE
  .DE
  Once this is done, booting from this disk will load and execute the block
***************
*** 482,489 ****
  .DS
  .TS
  lw(1.5i) l.
- \fB>boot\fP	(printed by some block 0 boots)
- 
  .B
  \fInn\fPBoot	\fR(printed by /boot)\fP
  :
--- 484,489 ----
***************
*** 490,496 ****
  .R
  .TE
  .DE
- The '>' is the prompt from the first bootstrap.
  It automatically boots /\fIboot\fP for you;
  if /\fIboot\fP is not found, the system will hang/loop forever.
  It is a very small and simple program, however, and can only
--- 490,495 ----
***************
*** 596,602 ****
  DEC TM02/03, TE16/TU45/TU77	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV ht0; sync
  DEC TS11, TU80/TS05	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV ts0; sync
  DEC TM11, TU10/TE10/TS03	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tm0; sync
! DEC TQK50, TK50	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tu0; sync
  EMULEX TC11	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tm0; sync
  .TE
  .DE
--- 595,601 ----
  DEC TM02/03, TE16/TU45/TU77	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV ht0; sync
  DEC TS11, TU80/TS05	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV ts0; sync
  DEC TM11, TU10/TE10/TS03	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tm0; sync
! DEC TQK50, TK50/TU81	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tu0; sync
  EMULEX TC11	\fB#\fP cd /dev; rm *mt*; ./MAKEDEV tm0; sync
  .TE
  .DE

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 16 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 16 of 22

The disktab entry for the Fuji 160 was changed to allow sufficient room
in the 'd' partition for the source distribution.

*** /etc/disktab.old	Fri Jan 25 12:32:54 1991
--- /etc/disktab	Fri May 10 21:51:47 1991
***************
*** 139,154 ****
  	:pe#322130:be#1024:fe#1024:\
  	:pg#171798:bg#1024:fg#1024:\
  	:ph#340522:bh#1024:fh#1024:
! 160|fuji|fuji160|Fujitsu 160:\
  	:ty=winchester:ns#32:nt#10:nc#823:sf:\
  	:b0=/mdec/si94uboot:\
  	:pa#9600:ba#1024:fa#1024:\
  	:pb#9600:bb#1024:fb#1024:\
  	:pc#244002:bc#1024:fc#1024:\
! 	:pd#125440:bd#1024:fd#1024:\
! 	:pe#118562:be#1024:fe#1024:\
! 	:pf#59520:bf#1024:ff#1024:\
! 	:pg#59042:bg#1024:fg#1024:\
  	:ph#263202:bh#1024:fh#1024:
  diva|DIVA|9300|Diva Comp V, Ampex 9300 (in direct mode):\
  	:ty=winchester:ns#33:nt#19:nc#815:sf:\
--- 139,154 ----
  	:pe#322130:be#1024:fe#1024:\
  	:pg#171798:bg#1024:fg#1024:\
  	:ph#340522:bh#1024:fh#1024:
! rm2x|160|fuji|fuji160|Fujitsu 160:\
  	:ty=winchester:ns#32:nt#10:nc#823:sf:\
  	:b0=/mdec/si94uboot:\
  	:pa#9600:ba#1024:fa#1024:\
  	:pb#9600:bb#1024:fb#1024:\
  	:pc#244002:bc#1024:fc#1024:\
! 	:pd#164800:bd#1024:fd#1024:\
! 	:pe#79360:be#1024:fe#1024:\
! 	:pf#39680:bf#1024:ff#1024:\
! 	:pg#39680:bg#1024:fg#1024:\
  	:ph#263202:bh#1024:fh#1024:
  diva|DIVA|9300|Diva Comp V, Ampex 9300 (in direct mode):\
  	:ty=winchester:ns#33:nt#19:nc#815:sf:\
***************
*** 447,454 ****
  	:b0=/mdec/rauboot:\
  	:pa#15884:ba#1024:fa#1024:\
  	:pb#16720:bb#1024:fb#1024:\
! 	:pc#278564:bc#1024:fc#1024:\
! 	:ph#311168:bh#1024:fh#1024:
  #
  # RX02 floppy disk drives
  #
--- 447,454 ----
  	:b0=/mdec/rauboot:\
  	:pa#15884:ba#1024:fa#1024:\
  	:pb#16720:bb#1024:fb#1024:\
! 	:pc#278596:bc#1024:fc#1024:\
! 	:ph#311200:bh#1024:fh#1024:
  #
  # RX02 floppy disk drives
  #

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 17 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 17 of 22

Define a nonrewind tape name for use by 'mt'.

*** /usr/src/sys/h/mtio.h.old	Fri Apr 15 09:20:12 1988
--- /usr/src/sys/h/mtio.h	Fri May 10 21:09:37 1991
***************
*** 64,67 ****
--- 64,68 ----
  
  #ifndef KERNEL
  #define	DEFTAPE	"/dev/rmt8"
+ #define	MT_DEF	"/dev/nrmt8"
  #endif

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 18 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 18 of 22

If the TAPE environment variable is not set, then use a non-rewind tape
device to prevent tapes from rewinding after a positioning command.

*** /usr/src/bin/mt.c.old	Sun Feb  8 14:24:56 1987
--- /usr/src/bin/mt.c	Fri May 10 21:08:47 1991
***************
*** 62,68 ****
  		argv += 2;
  	} else
  		if ((tape = getenv("TAPE")) == NULL)
! 			tape = DEFTAPE;
  	if (argc < 2) {
  		fprintf(stderr, "usage: mt [ -f device ] command [ count ]\n");
  		exit(1);
--- 62,68 ----
  		argv += 2;
  	} else
  		if ((tape = getenv("TAPE")) == NULL)
! 			tape = MT_DEF;
  	if (argc < 2) {
  		fprintf(stderr, "usage: mt [ -f device ] command [ count ]\n");
  		exit(1);

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 19 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 19 of 22

'restor' had size reduction changes made so the standalone version would
fit withing 48kb.  extra register variables were declared to reduce
the size of the generated code.

*** /usr/src/etc/restor/restor.c.old	Mon Apr 30 09:22:05 1990
--- /usr/src/etc/restor/restor.c	Sat Apr 13 17:02:58 1991
***************
*** 107,113 ****
  extern  long lseek();
  
  main(argc, argv)
! char *argv[];
  {
  	register char *cp;
  	char command;
--- 107,113 ----
  extern  long lseek();
  
  main(argc, argv)
! register char *argv[];
  {
  	register char *cp;
  	char command;
***************
*** 179,185 ****
  	int	xtrfile(), skip(), null();
  #endif
  	int	rstrfile(), rstrskip();
! 	struct dinode *ip, *ip1;
  
  #ifndef STANDALONE
  	if ((mt = open(magtape, 0)) < 0) {
--- 179,185 ----
  	int	xtrfile(), skip(), null();
  #endif
  	int	rstrfile(), rstrskip();
! 	register struct dinode *ip, *ip1;
  
  #ifndef STANDALONE
  	if ((mt = open(magtape, 0)) < 0) {
***************
*** 633,639 ****
  char	*n;
  {
  	register char *cp, *cp1;
! 	char c;
  
  	ino = ROOTINO;
  	if (*(cp = n) == '/')
--- 633,639 ----
  char	*n;
  {
  	register char *cp, *cp1;
! 	register char c;
  
  	ino = ROOTINO;
  	if (*(cp = n) == '/')
***************
*** 863,869 ****
  daddr_t	bn;
  {
  	register i;
! 	int j, sh;
  	daddr_t nb, nnb;
  	daddr_t indir[NINDIR];
  
--- 863,869 ----
  daddr_t	bn;
  {
  	register i;
! 	register int j, sh;
  	daddr_t nb, nnb;
  	daddr_t indir[NINDIR];
  
***************
*** 1229,1235 ****
   * read a bit mask from the tape into m.
   */
  readbits(m)
! short	*m;
  {
  	register i;
  
--- 1229,1235 ----
   * read a bit mask from the tape into m.
   */
  readbits(m)
! register short	*m;
  {
  	register i;
  

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 20 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 20 of 22

The number of blocks of inodes read in at a time was conditionally
made smaller if the standalone version was being compiled. This keeps
icheck under the 48kb limit for standalone utilities.

*** /usr/src/etc/icheck.c.old	Sun Apr 29 18:23:55 1990
--- /usr/src/etc/icheck.c	Sat Apr 20 20:52:37 1991
***************
*** 3,9 ****
  #endif
  
  #include <sys/param.h>
! #	define	NI	8
  #define	NB	10
  #define	BITS	8
  #define	MAXFN	500
--- 3,15 ----
  #endif
  
  #include <sys/param.h>
! 
! #ifdef	STANDALONE
! #define	NI	4
! #else
! #define	NI	8
! #endif
! 
  #define	NB	10
  #define	BITS	8
  #define	MAXFN	500

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 21 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 21 of 22

A new drive type 'rm2x' was added.  This is used for the Fuji 160
with the Emulex SC01 or SC03 in RM80 emulation mode(10x32x823)

*** /usr/src/etc/newfs.c.old	Tue Aug 21 12:35:59 1990
--- /usr/src/etc/newfs.c	Fri May 10 21:29:57 1991
***************
*** 4,18 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
- #endif not lint
  
! #ifndef lint
! static char sccsid[] = "@(#)newfs.c	5.2 (Berkeley) 8/18/88";
! #endif not lint
  
  /*
   * newfs: friendly front end to mkfs
--- 4,16 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)newfs.c	5.3 (2.11BSD) 5/10/91";
! #endif
  
  /*
   * newfs: friendly front end to mkfs
***************
*** 54,59 ****
--- 52,58 ----
  	{ "rp03", 16 },
  	{ "br1538d", 17 },
  	{ "ra82", 18 },
+ 	{ "rm2x", 19 },		/* Fuji 160 in pseudo RM80 mode */
  	{ 0, 0 }
  };
  
***************
*** 102,107 ****
--- 101,107 ----
  /* RP03 */	{ {16,304}, {15,304}, {12,304}, { 7,304}, {11,304}, { 5,304} },
  /* BR1538D */	{ {16,304}, {15,304}, {12,304}, { 7,304}, {11,304}, { 6,304} },
  /* RA82 */	{ {26,435}, {26,435}, {21,435}, {14,435}, {18,435}, {12,435} },
+ /* RM2X */	{ {11,160}, {10,160}, { 8,160}, { 6,160}, { 7,160}, { 5,160} },
  };
  
  main(argc, argv)

sms@wlv.imsd.contel.com (Steven M. Schultz) (05/18/91)

Subject: Part 22 of 22 /boot,/mdec,[T]MSCP updates
Index:	/sys/<many>, /usr/src/etc/<several> 2.11BSD

Description:
Repeat-By:
Fix:
	See part 0 (the README) for the Description, the Reason and
	the instructions on how update your system.

This is part 22 of 22

Small typo for a no-op of a program.

*** /usr/src/etc/config/config.c.old	Sun Feb 15 21:28:16 1987
--- /usr/src/etc/config/config.c	Fri May 10 20:53:32 1991
***************
*** 1,5 ****
  main()
  {
! 	puts("config hasn't been implemented under 2.10BSD.");
  	exit(-1);
  }
--- 1,5 ----
  main()
  {
! 	puts("config hasn't been implemented under 2.11BSD.");
  	exit(-1);
  }