Subject: RP07 boot support / MASSBUS bootblock consolidation (#476) Index: src/sys/mdec, src/etc/disktab, src/bin/disklabel/disklabel.8 Description: 1) The initial report concerned the lack of bootblock support for the RP07 disk type. The kernel driver supported the RP07 but none of the existing MASSBUS bootblocks had the correct geometry parameters. 2) Then it was pointed out that six of the bootblocks were identical except for the geometry numbers (sectos/track and tracks/cylinder). Not a 'bug' in the traditional sense it did feel "ugly". 3) The disktab(5)) entry for the rp07 incorrectly specified the rp04/5/6 bootblock. 4) The disklabel manpage had incorrect usage for installing bootblock. Repeat-By: Observation. 1) the sources in /usr/src/sys/mdec have support for RP04,5,6 but no support for RP07 2) cd /usr/src/sys/mdec and diff pairs of these files: dvhpuboot.s hpuboot.s rm03uboot.s rm05uboot.s si51uboot.s si94uboot.s Note the only meaningful differences are the NSECT and NTRAK values. 3) examine the rp07 entry in usr/src/etc/disktab and note the use of 'b0=/mdec/hpuboot' 4) disklabel usage requires '-b newboot' appear before the device name Fix: Afer a short email exchange with bqt@softjar.se (who provided the src/sys//mdec changes) the decision was made to consolidate the six boot block sources AND add rp07 support into a single source file. Creating 7 bootblocks from a single source file is wonderful & elegant In addition to the updating the disklabel manpage the setup documentation in doc/2.11/setup.2.11/2.t has the RP07 entry added. NOTE: Files will be removed from usr/src/sys/mdec - if you want to keep the deleted files then create a backup. Cut where indicated and save to the file /tmp/476.patch Then: cd / patch -p0 < /tmp/476.patch cd /usr/src/bin/disklabel make install make clean cd /usr/src/sys/mdec make install make clean rm dvhpuboot.s hpuboot.s rm03uboot.s rm05uboot.s si51uboot.s si94uboot.s IF you have an RP07 entry in /etc/disktab then manually edit /etc/disktab and change "b0=/mdec/hpuboot" to be "b0=/mdec/rp07uboot" This and previous updates to 2.11BSD are available at the following locations: ftp://ftp.dfupdate.se/pub/pdp11/2.11BSD https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD/Patches/ ftp://ftp.2bsd.com/2.11BSD --------------------------cut here-------------------- *** ./usr/src/sys/mdec/Makefile.old Tue Dec 5 22:38:50 1995 --- ./usr/src/sys/mdec/Makefile Thu Sep 1 06:23:09 2022 *************** *** 3,18 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 1.2 (2.11BSD GTE) 1995/12/05 # ! ALL= bruboot dvhpuboot hkuboot hpuboot rauboot rkuboot rluboot \ ! rm03uboot rm05uboot si51uboot si94uboot si95uboot rx02uboot \ rx01uboot ! all: ${ALL} ${ALL}: ! /lib/cpp -E $*.s | sed -e 's;^#;/;' | as -o a.out nm -u a.out size a.out strip a.out --- 3,19 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 2.0 (2.11BSD) 2022/8/30 # ! ALL= bruboot hkuboot rauboot rkuboot rluboot si95uboot rx02uboot \ rx01uboot ! MBDISK= hpuboot rm03uboot rm05uboot rp07uboot dvhpuboot si51uboot si94uboot + all: ${ALL} ${MBDISK} + ${ALL}: ! /lib/cpp -t -E $*.s | sed -e 's;^#;/;' | as -o a.out nm -u a.out size a.out strip a.out *************** *** 19,41 **** dd if=a.out of=b.out bs=16 skip=1 dd if=b.out of=$@ conv=sync bruboot: bruboot.s - dvhpuboot: dvhpuboot.s hkuboot: hkuboot.s - hpuboot: hpuboot.s rauboot: rauboot.s rkuboot: rkuboot.s rluboot: rluboot.s - rm03uboot: rm03uboot.s - rm05uboot: rm05uboot.s - si51uboot: si51uboot.s - si94uboot: si94uboot.s si95uboot: si95uboot.s rx02uboot: rx02uboot.s rx01uboot: rx01uboot.s clean: ! rm -f x.s a.out b.out ${ALL} ! install: cp *boot ${DESTDIR}/mdec --- 20,44 ---- dd if=a.out of=b.out bs=16 skip=1 dd if=b.out of=$@ conv=sync + ${MBDISK}: mbuboot.s + /lib/cpp -t -D$@ -E mbuboot.s | sed -e 's;^#;/;' | as -o a.out + nm -u a.out + size a.out + strip a.out + dd if=a.out of=b.out bs=16 skip=1 + dd if=b.out of=$@ conv=sync + bruboot: bruboot.s hkuboot: hkuboot.s rauboot: rauboot.s rkuboot: rkuboot.s rluboot: rluboot.s si95uboot: si95uboot.s rx02uboot: rx02uboot.s rx01uboot: rx01uboot.s clean: ! rm -f x.s a.out b.out ${ALL} ${MBDISK} ! install: all cp *boot ${DESTDIR}/mdec *** ./usr/src/bin/disklabel/disklabel.8.old Mon Jun 12 23:35:15 1995 --- ./usr/src/bin/disklabel/disklabel.8 Tue Aug 30 08:40:55 2022 *************** *** 32,40 **** .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)disklabel.8 8.2.1 (2.11BSD) 1995/04/21 .\" ! .TH DISKLABEL 8 "April 21, 1995" .UC 2 .SH NAME disklabel \- read and write disk pack label --- 32,40 ---- .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" ! .\" @(#)disklabel.8 8.3 (2.11BSD) 2022/8/30 .\" ! .TH DISKLABEL 8 "August 30, 2022" .UC 2 .SH NAME disklabel \- read and write disk pack label *************** *** 313,319 **** On-disk and in-core labels are unchanged. .PP .in +0.5i ! disklabel -w -B /dev/rra0a -b newboot ra81x .br .in -0.5i .PP --- 313,319 ---- On-disk and in-core labels are unchanged. .PP .in +0.5i ! disklabel -w -B -b newboot /dev/rra0a ra81x .br .in -0.5i .PP *** ./usr/src/etc/disktab.old Tue Dec 5 22:25:33 1995 --- ./usr/src/etc/disktab Tue Aug 30 08:42:34 2022 *************** *** 1,4 **** ! # @(#)disktab 1.3 (2.11BSD) 1995/12/05 # # Disk geometry and partition layout tables. # Key: --- 1,4 ---- ! # @(#)disktab 1.4 (2.11BSD) 2022/8/30 # # Disk geometry and partition layout tables. # Key: *************** *** 114,120 **** rp07|RP07|DEC RP07:\ :ty=fixed:ns#50:nt#32:nc#630:sf:\ ! :b0=/mdec/hpuboot:\ :pa#19200:oa#0:ba#1024:fa#1024:ta=2.11BSD:\ :pb#51200:ob#19200:bb#1024:fb#1024:tb=swap:\ :pc#1006400:oc#0:bc#1024:fc#1024:\ --- 114,120 ---- rp07|RP07|DEC RP07:\ :ty=fixed:ns#50:nt#32:nc#630:sf:\ ! :b0=/mdec/rp07uboot:\ :pa#19200:oa#0:ba#1024:fa#1024:ta=2.11BSD:\ :pb#51200:ob#19200:bb#1024:fb#1024:tb=swap:\ :pc#1006400:oc#0:bc#1024:fc#1024:\ *** ./usr/doc/2.10/setup.2.11/2.t.old Sat Jan 4 12:35:16 2020 --- ./usr/doc/2.10/setup.2.11/2.t Tue Aug 30 08:49:51 2022 *************** *** 2,8 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)2.t 1.11 (2.11BSD) 2020/1/4 .\" .ds lq `` .ds rq '' --- 2,8 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)2.t 1.12 (2.11BSD) 2022/8/30 .\" .ds lq `` .ds rq '' *************** *** 416,421 **** --- 416,422 ---- si95uboot si SI 9500, CDC 9766 dvhpuboot xp Diva Comp V, Ampex 9300 hpuboot xp RP04/05/06 + rp07uboot xp RP07 rm03uboot xp RM03 rm05uboot xp RM05 or SI 9500, CDC 9766 si51uboot xp SI 6100, Fujitsu Eagle 2351A *************** *** 466,472 **** \fB#\fP disk=hk (if you have RK06's or RK07's) \fB#\fP disk=rl (if you have RL01's or RL02's) \fB#\fP disk=ra (if you have an MSCP drive) ! \fB#\fP disk=xp (if you have an RP06, RM03, RM05, or other SMD drive) .TE .DE .PP --- 467,473 ---- \fB#\fP disk=hk (if you have RK06's or RK07's) \fB#\fP disk=rl (if you have RL01's or RL02's) \fB#\fP disk=ra (if you have an MSCP drive) ! \fB#\fP disk=xp (if you have an RP04/5/6/7, RM03, RM05, or other SMD drive) .TE .DE .PP *** ./VERSION.old Sun Aug 28 16:29:13 2022 --- ./VERSION Tue Aug 30 21:32:35 2022 *************** *** 1,5 **** ! Current Patch Level: 475 ! Date: August 28, 2022 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 476 ! Date: August 30, 2022 2.11 BSD ============ *** /dev/null Tue Aug 30 16:46:35 2022 --- ./usr/src/sys/mdec/mbuboot.s Tue Aug 30 08:32:50 2022 *************** *** 0 **** --- 1,300 ---- + MAJOR = 10. / major # from bdevsw[] + + / Massbus disk bootstrap + / + / 2022/08/28 - Unified the different Massbus disk bootstrap sources into 1. + / + / 1995/05/31 - The unit number needs to go in bits 3-5 of bootdev + / because the partition number now goes into bits 0-2. + / + / 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 + + #ifdef hpuboot + / RP04/05/06 + NSECT=22. + NTRAK=19. + #endif + + #ifdef rm03uboot + / RM03 + NSECT=32. + NTRAK=5. + #endif + + #ifdef rm05uboot + / RM05 + NSECT=32. + NTRAK=19. + #endif + + #ifdef rp07uboot + / RP07 + NSECT=50. + NTRAK=32. + #endif + + #ifdef dvhpuboot + / Diva Comp. V, Ampex 9300 + NSECT=33. + NTRAK=19. + #endif + + #ifdef si51uboot + / Fujitsu Eagle (2351A) on SI 6100 Controller bootstrap + NSECT=48. + NTRAK=20. + #endif + + #ifdef si94uboot + / Fujitsu 160 on SI 9400 or Emulex SC01B Controller bootstrap + NSECT=32. + NTRAK=10. + #endif + + / 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 + + / constants: + CLSIZE = 2. / physical disk blocks per logical block + CLSHFT = 1. / shift to multiply by CLSIZE + BSIZE = 512.*CLSIZE / logical block size + INOSIZ = 64. / size of inode in bytes + NDIRIN = 4. / number of direct inode addresses + ADDROFF = 12. / offset of first address in inode + INOPB = BSIZE\/INOSIZ / inodes per logical block + INOFF = 31. / inode offset = (INOPB * (SUPERB+1)) - 1 + PBSHFT = -4 / shift to divide by inodes per block + WC = -256.*CLSIZE / word count + + / The boot options and device are placed in the last SZFLAGS bytes + / at the end of core by the kernel for autobooting. + 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 + + .. = ENDCORE-512.-SZFLAGS / save room for boot flags + + / entry is made by jsr pc,*$0 + / so return can be rts pc + + / 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 + 1: + mov (r0)+,(r1)+ + cmp r1,$end + blo 1b + jmp *$2f + + / On error, restart from here. + restart: + clr r0 + / clear core to make things clean + 2: + clr (r0)+ + cmp r0,sp + 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 + jsr pc,iget + clr r2 / offset + again: + jsr pc,readdir + beq restart / error - restart + mov 4(r0),r4 / dp->d_namlen + cmp r4,$bootlen / if (bootlen == dp->d_namlen) + bne again / nope, go try next entry + mov r0,r3 + add $6,r3 / r3 = dp->d_name + mov r1,r5 / r5 = filename + 9: + cmpb (r3)+,(r5)+ + bne again / no match - go read next entry + sob r4,9b + mov (r0),r0 / r0 = dp->d_ino + jsr pc,iget / fetch boot's inode + br loadfile / 'boot'- go read it + + / get the inode specified in r0 + iget: + add $INOFF,r0 + mov r0,r5 + ash $PBSHFT,r0 + bic $!7777,r0 + mov r0,dno + clr r0 + jsr pc,rblk + bic $!17,r5 + mov $INOSIZ,r0 + mul r0,r5 + add $buf,r5 + mov $inod,r4 + 1: + movb (r5)+,(r4)+ + sob r0,1b + rts pc + + readdir: + bit $BSIZE-1,r2 + bne 1f + jsr pc,rmblk / read mapped block (bno) + br err / end of file branch + clr r2 / start at beginning of buf + 1: + mov $buf,r0 + add r2,r0 / dp = buf+offset + add buf+2(r2),r2 / dp += dp->d_reclen + tst (r0) / dp->d_ino == 0? + beq readdir / yes - go look at next + rts pc / return with r0 = &dp->d_ino + err: + clr r0 / return with + rts pc / dp = NULL + + loadfile: + clr bno / start at block 0 of inode in 'inod' + / read file into core until + / a mapping error, (no disk address) + clr r1 + 1: + jsr pc,rmblk + br 1f + mov $buf,r2 + 2: + mov (r2)+,(r1)+ + cmp r2,$buf+BSIZE + blo 2b + br 1b + / relocate core around + / assembler header + 1: + clr r0 + cmp (r0),$407 + bne 2f + 1: + mov 20(r0),(r0)+ + cmp r0,sp + blo 1b + / enter program and + / restart if return + 2: + mov ENDCORE-BOOTOPTS, r4 + mov unit,r3 + ash $3,r3 / unit # in bits 3-5, partition # is 0 + bis $MAJOR\<8.,r3 + mov ENDCORE-CHECKWORD, r2 + mov csr,r1 + jsr pc,*$0 + br restart + + / read a mapped block + / offset in file is in bno. + / skip if success, no skip if fail + / the algorithm only handles a single + / indirect block. that means that + / files longer than NDIRIN+256 blocks (260kb) cannot + / be loaded. + rmblk: + add $2,(sp) + mov bno,r0 + cmp r0,$NDIRIN + blt 1f + mov $NDIRIN,r0 + 1: + ash $2,r0 + mov addr+2(r0),dno + mov addr(r0),r0 + bne 1f + tst dno + beq 2f + 1: + jsr pc,rblk + mov bno,r0 + inc bno + sub $NDIRIN,r0 + blt 1f + ash $2,r0 + mov buf+2(r0),dno + mov buf(r0),r0 + bne rblk + tst dno + bne rblk + 2: + sub $2,(sp) + 1: + rts pc + + read = 70 + preset = 20 + go = 1 + fmt22 = 10000 + + rmcs1 = 0 + rmda = rmcs1+6 + rmcs2 = rmcs1+10 + rmds = rmcs1+12 + rmof = rmcs1+32 + rmca = rmcs1+34 + + / massbus disk driver. + / low order address in dno, + / high order in r0. + rblk: + mov r1,-(sp) + mov dno,r1 + .if CLSIZE-1 + 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 + + bootnm: + bootlen = 4 / strlen(bootnm) + unit: 0 + csr: 0 + end: + + inod = ..-512.-BSIZE / room for inod, buf, stack + addr = inod+ADDROFF / first address in inod + buf = inod+INOSIZ + bno = buf+BSIZE + dno = bno+2