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
