BSD 4_2 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 00:44:41 +0000 (16:44 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 00:44:41 +0000 (16:44 -0800)
Work on file usr/src/sys/mdec/hpboot.s
Work on file usr/src/sys/mdec/hkboot.s
Work on file usr/src/sys/mdec/htboot.s
Work on file usr/src/sys/mdec/httoggle.s
Work on file usr/src/sys/mdec/installboot.c
Work on file usr/src/sys/mdec/tmtoggle.s
Work on file usr/src/sys/mdec/mtboot.s
Work on file usr/src/sys/mdec/tmboot.s
Work on file usr/src/sys/mdec/mttoggle.s
Work on file usr/src/sys/mdec/rlboot.s
Work on file usr/src/sys/mdec/raboot.s
Work on file usr/src/sys/mdec/tsboot.s
Work on file usr/src/sys/mdec/tstoggle.s
Work on file usr/src/sys/mdec/upboot.s
Work on file usr/src/sys/mdec/uttoggle.s

Synthesized-from: CSRG/cd1/4.2

15 files changed:
usr/src/sys/mdec/hkboot.s [new file with mode: 0644]
usr/src/sys/mdec/hpboot.s [new file with mode: 0644]
usr/src/sys/mdec/htboot.s [new file with mode: 0644]
usr/src/sys/mdec/httoggle.s [new file with mode: 0644]
usr/src/sys/mdec/installboot.c [new file with mode: 0644]
usr/src/sys/mdec/mtboot.s [new file with mode: 0644]
usr/src/sys/mdec/mttoggle.s [new file with mode: 0644]
usr/src/sys/mdec/raboot.s [new file with mode: 0644]
usr/src/sys/mdec/rlboot.s [new file with mode: 0644]
usr/src/sys/mdec/tmboot.s [new file with mode: 0644]
usr/src/sys/mdec/tmtoggle.s [new file with mode: 0644]
usr/src/sys/mdec/tsboot.s [new file with mode: 0644]
usr/src/sys/mdec/tstoggle.s [new file with mode: 0644]
usr/src/sys/mdec/upboot.s [new file with mode: 0644]
usr/src/sys/mdec/uttoggle.s [new file with mode: 0644]

diff --git a/usr/src/sys/mdec/hkboot.s b/usr/src/sys/mdec/hkboot.s
new file mode 100644 (file)
index 0000000..d8ce57a
--- /dev/null
@@ -0,0 +1,115 @@
+/*     hkboot.s        6.1     83/07/29        */
+
+/*
+ * RK07 1st level boot program: loads next 7.5Kbytes from
+ * boot sector of file system and sets it up to run.
+ * Always reads from drive 0.
+ */
+       .set    RELOC,0x50000
+       .set    BOOTSIZE,15             /* size of boot in sectors */
+       .set    SID,62                  /* system ID register */
+/* UBA registers */
+       .set    UBA_CNFGR,0             /* UBA configuration register */
+       .set    UBA_CR,4                /* UBA control register offset */
+       .set    UBA_MAP,0x800           /* UBA offset to map reg's */
+       .set    UBAinit,1               /* UBA init bit in UBA control reg */
+       .set    pUBIC,16                /* Unibus init complete */
+/* RK611 registers and bits */
+       .set    HK,0177440-0160000      /* address of RK611 */
+       .set    HK_cs1,HK+0             /* control and status */
+       .set    HK_wc,HK+2              /* word count */
+       .set    HK_ba,HK+4              /* bus address */
+       .set    HK_da,HK+6              /* disk address */
+       .set    HK_dc,HK+020            /* desired cylinder */
+       .set    HKBPSECT,512            /* bytes per sector */
+       .set    HK_GO,1                 /* go bit */
+       .set    HK_PACK,2               /* pack acknowledge */
+       .set    HK_RCOM,020             /* read command */
+       .set    HK_SEL7,02000           /* select RK07 disk */
+       .set    HK_pRDY,7               /* position of ready bit */
+       .set    HK_pERR,15              /* position of error bit */
+
+init:
+/* r9  UBA address */
+/* r10 umem addr */
+       .word   0                       /* entry mask for dec monitor */
+       nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
+       nop;nop;
+/* get cpu type and find the first uba */
+       mfpr    $SID,r0
+       extzv   $24,$8,r0,r0            /* get cpu type */
+       ashl    $2,r0,r1
+       movab   physUBA,r2              /* get physUBA[cpu] */
+       addl2   r1,r2
+       movl    (r2),r9
+       movab   physUMEM,r2             /* get physUMEM[cpu] */
+       addl2   r1,r2
+       movl    (r2),r10
+/* if 780, init uba */
+       cmpl    r0,$1
+       bneq    2f
+       movl    $UBAinit,UBA_CR(r9)
+1:
+       bbc     $pUBIC,UBA_CNFGR(r9),1b
+2:
+/* init rk611, set vv in drive 0; if any errors, give up */
+       movw    $HK_SEL7+HK_GO,HK_cs1(r10)
+1:
+       movw    HK_cs1(r10),r0
+       bbc     $HK_pRDY,r0,1b
+       bbs     $HK_pERR,r0,9f
+       movw    $HK_SEL7+HK_PACK+HK_GO,HK_cs1(r10)
+1:
+       movw    HK_cs1(r10),r0
+       bbc     $HK_pRDY,r0,1b
+       bbc     $HK_pERR,r0,start
+9:
+       halt
+/* relocate to high core */
+start:
+       movl    r5,r11                  /* boot flags */
+       movl    $RELOC,sp
+       moval   init,r6
+       movc3   $end,(r6),(sp)
+       jmp     *$RELOC+start2
+/* now running relocated */
+/* bring in the boot program */
+       .set    PROGSIZE,(BOOTSIZE*HKBPSECT)
+start2:
+       movw    $0,HK_dc(r10)
+       movw    $1,HK_da(r10)
+       movw    $-PROGSIZE/2,HK_wc(r10)
+       clrl    r0
+1:
+       bisl3   $0x80000000,r0,UBA_MAP(r9)
+       addl2   $4,r9
+       aobleq  $BOOTSIZE,r0,1b
+       clrw    HK_ba(r10)
+       movw    $HK_SEL7+HK_RCOM+HK_GO,HK_cs1(r10)
+hkrdy:
+       movw    HK_cs1(r10),r0
+       bbc     $HK_pRDY,r0,hkrdy
+       bbs     $HK_pERR,r0,hkerr
+       brw     done
+hkerr:
+       halt                    /* ungraceful */
+done:
+       movl    $PROGSIZE,r3
+clrcor:
+       clrq    (r3)
+       acbl    $RELOC,$8,r3,clrcor
+/* start loaded program */
+       movl    $3,r10                  /* major("/dev/hk0a") */
+       calls   $0,*$0
+       brw     start2
+physUBA:
+       .long   0
+       .long   0x20006000      /* 11/780 */
+       .long   0xf30000        /* 11/750 */
+       .long   0xf26000        /* 11/730 */
+physUMEM:
+       .long   0
+       .long   0x2013e000      /* 11/780 */
+       .long   0xffe000        /* 11/750 */
+       .long   0xffe000        /* 11/730 */
+end:
diff --git a/usr/src/sys/mdec/hpboot.s b/usr/src/sys/mdec/hpboot.s
new file mode 100644 (file)
index 0000000..b3f1916
--- /dev/null
@@ -0,0 +1,103 @@
+/*     hpboot.s        6.1     83/07/29        */
+
+/*
+ * RP??/RM?? 1st level boot program: loads next 7.5Kbytes from
+ * boot sector of file system and sets it up to run.
+ * Always reads from drive 0.
+ */
+       .set    BOOTSIZE,15             /* size of boot in sectors */
+       .set    RELOC,0x70000
+/* MBA registers */
+       .set    M_cr,4                  /* MBA control reg */
+       .set    M_var,12                /* MBA virt addr reg */
+       .set    M_bc,16                 /* MBA byte count reg */
+       .set    M_map,0x800             /* start of MBA map reg's */
+       .set    MBAinit,1               /* MBA init bit in MBA control reg */
+/* Drive information */
+       .set    RP,0x400                /* start of drive registers */
+       .set    RP_cr,RP+0              /* control status register */
+       .set    RP_sr,RP+4              /* drive status reg */
+       .set    RP_stk,RP+0x14          /* desired track/sector reg */
+       .set    RP_dt,RP+0x18           /* drive type reg */
+       .set    RP_off,RP+0x24          /* RP offset reg */
+       .set    RP_cyl,RP+0x28          /* desired cyl reg */
+       .set    RPBPSECT,512            /* bytes per sector */
+/* RP?? function codes, status bits  */
+       .set    RP_GO,1                 /* go */
+       .set    RP_RED,070              /* read */
+       .set    RP_DC,010               /* drive clear */
+       .set    RP_RIP,020              /* read in preset */
+       .set    RP_FMT,0x1000           /* format 22 */
+       .set    RP_MOL,0x1000           /* medium on line */
+       .set    RP_DRY,0200             /* drive ready */
+       .set    RP_ERR,040000           /* composite error */
+       .set    RP_pDRY,7               /* bit position of RP_DRY */
+       .set    RP_pERR,14              /* bit position of RP_ERR */
+
+init:
+       .word   0                       /* entry mask for DEC monitor */
+       nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
+       nop;nop;
+start:
+       movl    r5,r11
+       movl    $RELOC,sp
+       moval   init,r6
+       movc3   $end,(r6),(sp)
+       jmp     *$RELOC+start1
+/* running relocated */
+start1:
+/* get cpu type */
+       .set    SID,0x3e
+       mfpr    $SID,r0
+       extzv   $24,$8,r0,r0
+       ashl    $2,r0,r1
+/* get mba location and init it */
+       moval   physMBA,r2
+       addl3   r1,r2,r3
+       movl    (r3),r9
+       movl    $MBAinit,M_cr(r9)
+/* read-in-preset the drive and set format */
+       movl    $RP_RIP+RP_GO,RP_cr(r9)
+       movl    $RP_FMT,RP_off(r9) 
+
+       .set    PROGSIZE,(BOOTSIZE*RPBPSECT)
+start2:
+       movl    $0,RP_cyl(r9)
+       movl    $1,RP_stk(r9)
+       movl    $-PROGSIZE,M_bc(r9)
+/* set up MASSBUS map for DMA */
+       clrl    r0
+1:
+       bisl3   $0x80000000,r0,M_map(r9)[r0]
+       aobleq  $BOOTSIZE,r0,1b
+       clrl    M_var(r9)
+       movl    $RP_RED+RP_GO,RP_cr(r9)
+rprdy:
+       movl    RP_sr(r9),r0
+       bbc     $RP_pDRY,r0,rprdy
+       bbs     $RP_pERR,r0,rperr
+       clrl    r3
+/* Eagle's are too fast for the controller. Slow the thing down. */
+buzz:  acbl    $2000,$1,r3,buzz
+       bicpsw  $2
+       jbr     clear
+rperr:
+       halt
+/* clear core and execute program */
+clear:
+       movl    $PROGSIZE,r3
+clrcor:
+       clrq    (r3)
+       acbl    $RELOC,$8,r3,clrcor
+/* run loaded program */
+       clrl    r10                     /* major("/dev/hp0a") */
+       calls   $0,*$0
+       brw     start2
+
+       .align  2
+physMBA:
+       .long   0
+       .long   0x20010000
+       .long   0xf28000
+
+end:
diff --git a/usr/src/sys/mdec/htboot.s b/usr/src/sys/mdec/htboot.s
new file mode 100644 (file)
index 0000000..5ae2e9d
--- /dev/null
@@ -0,0 +1,200 @@
+/*     htboot.s        6.1     83/07/29        */
+
+/*
+ * VAX tape boot block for distribution tapes
+ * works on massbus tu10/te16/tu45/tu77
+ *
+ * reads a program from a tp directory on a tape and executes it
+ * program must be stripped of the header and is loaded ``bits as is''
+ * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
+ */
+       .set    RELOC,0x70000
+/* a.out defines */
+       .set    HDRSIZ,040      /* size of file header for VAX */
+       .set    MAGIC,0410      /* file type id in header */
+       .set    TSIZ,4          /* text size */
+       .set    DSIZ,8          /* data size */
+       .set    BSIZ,12         /* bss size */
+       .set    TENT,024        /* task header entry loc */
+/* tp directory definitions */
+       .set    FILSIZ,38       /* tp direc offset for file size */
+       .set    BNUM,44         /* tp dir offset for start block no. */
+       .set    ENTSIZ,64       /* size of 1 TP dir entry, bytes */
+       .set    PTHSIZ,32       /* size of TP path name, bytes */
+       .set    BLKSIZ,512      /* tape block size, bytes */
+       .set    NUMDIR,24       /* no. of dir blocks on tape */
+       .set    ENTBLK,8        /* no. of dir entries per tape block */
+/* processor registers and bits */
+       .set    RXCS,32
+       .set    RXDB,33
+       .set    TXCS,34
+       .set    TXDB,35
+       .set    RXCS_DONE,0x80
+       .set    TXCS_RDY,0x80
+       .set    TXCS_pr,7       /* bit position of TXCS ready bit */
+       .set    RXCS_pd,7       /* bit position of RXCS done bit */
+/* MBA registers */
+       .set    MBA_CSR,0       /* configuration and status register */
+       .set    MBA_CR,4        /* MBA control reg */
+       .set    MBA_SR,8        /* MBA status reg */
+       .set    MBA_VAR,12      /* MBA virt addr reg */
+       .set    MBA_BCR,16      /* MBA byte count reg */
+       .set    MBA_MAP,0x800   /* start of MBA map reg's */
+       .set    MRV,0x80000000
+/* TE16/TU45/TU77 mba registers */
+       .set    HTCS1,0         /* HT control 1 reg */
+       .set    HTDS,4          /* status reg */
+       .set    HTER,8          /* error reg */
+       .set    HTAS,16         /* attention summary */
+       .set    HTFC,20         /* frame count */
+       .set    HTTC,36         /* HT tape control */
+/* HT commands */
+       .set    GO,1            /* GO bit */
+       .set    HT_REW,6        /* rewind, on-line */
+       .set    HT_DCLR,010     /* drive clear */
+       .set    HT_SREV,032     /* space reverse */
+       .set    HT_RCOM,070     /* read forward */
+/* HT bits */
+       .set    ERR,040000      /* composite error bit in status reg */
+       .set    TCHAR,012300    /* unit 0, odd parity, PDP11, 1600 BPI NRZ, */
+                               /* abort on error - for tape controller */
+       .set    DRDY,0200       /* HT/drive ready in status reg */
+       .set    HT_pd,7         /* bit position of HT DRDY bit */
+       .set    HT_pe,14        /* bit position of HT ERROR bit */
+/* local stack variables */
+       .set    tapa,-4         /* desired tape addr */
+       .set    mtapa,-8        /* current tape addr */
+       .set    name,-8-PTHSIZ  /* operator-typed file name */
+/* register usage */
+       .set    rMBA,r10
+       .set    rHT,r11
+
+/* initialization */
+init:
+       mull2   $0x80,%rHT
+       addl2   $0x400,%rHT
+       addl2   %rMBA,%rHT
+       movl    $RELOC,fp       /* core loc to which to move this program */
+       addl3   $name,fp,sp     /* set stack pointer, leaving room for locals */
+       clrl    r0
+1:
+       movc3   $end,(r0),(fp)  /* move boot up to relocated position */
+       jmp     start+RELOC
+start:
+       movl    $1,MBA_CR(%rMBA)        /* MBA init */
+       movl    $TCHAR,HTTC(%rHT)       /* drive no., etc. */
+       movl    $HT_DCLR+GO,HTCS1(%rHT) /* drive clear */
+       bsbw    rew                     /* rewind input tape */
+       movab   name(fp),r4             /* start of filename storage */
+       movzbl  $'=,r0                  /* prompt character */
+       bsbw    putc                    /* output char to main console */
+/* read in a file name */
+       movl    r4,r1                   /* loc at which to store file name */
+nxtc:
+       bsbw    getc                    /* get input char's in file name */
+       cmpb    r0,$012                 /* terminator ? */
+       beql    nullc
+       movb    r0,(r1)+
+       brb     nxtc
+nullc:
+       subl3   r4,r1,r9                /* size of path name */
+       beql    start                   /* dumb operator */
+       clrb    (r1)+
+       incl    r9
+/* user-specified TP filename has been stored at name(fp) */
+/* read in entire tp directory contents into low core */
+dirred:
+       movl    $8,tapa(fp)             /* tp directory starts at block 8 */
+       movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
+       bsbw    taper                   /* read no. bytes indicated */
+/* search entire directory for user-specified file name */
+       clrl    r5                      /* dir buff loc = 0 */
+nxtdir:
+       cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
+       beql    fndfil                  /* found match */
+       acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
+                                       /* see if done with tp dir */
+       brw     start                   /* entry not in directory; start over */
+/* found desired tp dir entry */
+fndfil:
+       movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
+       addl2   $7,tapa(fp)             /* skip 7 boot blocks */
+       movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
+       insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
+       cmpl    r6,$RELOC-512           /* check if file fits below stack */
+       blss    filok                   /* file o.k. */
+       brw     start                   /* file too large */
+/* time to read in desired file from tape */
+filok:
+       movl    r6,r7                   /* save r6 */
+       bsbb    taper
+       bsbw    rew
+/* clear core */
+       subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
+1:
+       clrb    (r7)+
+       sobgtr  r0,1b
+/* time to jump to start of file & execute */
+       addl3   $20,fp,ap
+       clrl    r5
+       calls   $0,(r5)
+       brw     start
+/* taper: movcTAPE (r6),tapa(fp),0 */
+rew2:
+       bsbb    rew                     /* beginning of tape */
+taper0:
+       bsbb    rrec                    /* advance 1 block; never want blk0 */
+taper:
+       clrl    r0                      /* page no. */
+       cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
+       bgtr    rew2
+       blss    taper0
+1:
+       bsbb    rrec
+       acbl    $1,$-BLKSIZ,r6,1b
+       rsb
+/* rew: rewind the tape */
+rew:
+       clrl    mtapa(fp)               /* current position */
+       movl    $HT_REW+GO,HTCS1(%rHT)  /* rewind */
+       rsb
+/* rrec: read 1 block from mag tape into page (r0) */
+rrec:
+       /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
+       movl    HTDS(%rHT),r2
+       bbc     $HT_pd,r2,rrec          /* HT & drive ready ? */
+       movl    $-BLKSIZ,MBA_BCR(%rMBA)
+       bisl3   $MRV,r0,MBA_MAP(%rMBA) 
+       clrl    MBA_VAR(%rMBA)
+       movl    $HT_RCOM+GO,HTCS1(%rHT) /* read forward */
+1:
+       movl    HTDS(%rHT),r2
+       bbc     $HT_pd,r2,1b
+       movl    HTER(%rHT),r2
+       bbc     $HT_pe,r2,2f            /* any read errors ? */
+       clrl    HTDS(%rHT)              /* clear status - try to recover */
+       mnegl   $1,HTFC(%rHT)           /* frame count for backspace */
+       movl    $HT_SREV+GO,HTCS1(%rHT) /* space reverse */
+       brb     rrec
+2:
+       incl    r0                      /* next page no. */
+       incl    mtapa(fp)               /* mag tape block position */
+       rsb
+getc:
+       mfpr    $RXCS,r0
+       bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
+       mfpr    $RXDB,r0
+       extzv   $0,$7,r0,r0
+       cmpb    r0,$015
+       bneq    putc
+       bsbb    putc
+       movb    $0,r0
+       bsbb    putc
+       movb    $012,r0
+putc:
+       mfpr    $TXCS,r2
+       bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
+       extzv   $0,$7,r0,r0
+       mtpr    r0,$TXDB
+       rsb
+end:
diff --git a/usr/src/sys/mdec/httoggle.s b/usr/src/sys/mdec/httoggle.s
new file mode 100644 (file)
index 0000000..b66046f
--- /dev/null
@@ -0,0 +1,22 @@
+/*     httoggle.s      6.1     83/07/29        */
+
+/*
+ * Prototype toggle in bootstrap code for ht type tapes.
+ * If on anything but a 780 with a tape at slave 1 of mba 1
+ * this will have to be repaired by patching mba and ht.
+ */
+       movl    mba,r10
+       mull3   ht,$0x80,r11
+       addl3   r11,r10,r11
+       addl2   $0x400,r11
+       movl    $1,4(r10)
+       movl    $9,(r11)
+       cvtwl   $012300,0x24(r11)
+       clrl    12(r10)
+       movl    $0x80000000,0x800(r10)
+       cvtwl   $-512,16(r10)
+       movl    $0x39,(r11)
+       halt
+       .align  2
+mba:   .long   0x20012000
+ht:    .long   0
diff --git a/usr/src/sys/mdec/installboot.c b/usr/src/sys/mdec/installboot.c
new file mode 100644 (file)
index 0000000..5e540a1
--- /dev/null
@@ -0,0 +1,39 @@
+/*     installboot.c   6.1     83/07/29        */
+
+#include "../h/param.h"
+#include "../h/fs.h"
+
+char bootimage[BBSIZE];
+
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+       int fd;
+
+       if (argc != 4) {
+               printf("Usage: installboot bootblock bootprog device\n");
+               exit(1);
+       }
+       fd = open(argv[1], 0);
+       if (fd < 0) {
+               perror(argv[1]);
+               exit(1);
+       }
+       read(fd, bootimage, DEV_BSIZE);
+       close(fd);
+       fd = open(argv[2], 0);
+       if (fd < 0) {
+               perror(argv[2]);
+               exit(1);
+       }
+       read(fd, &bootimage[DEV_BSIZE], BBSIZE - DEV_BSIZE);
+       close(fd);
+       fd = open(argv[3], 1);
+       if (fd < 0) {
+               perror(argv[3]);
+               exit(1);
+       }
+       write(fd, bootimage, BBSIZE);
+       close(fd);
+}
diff --git a/usr/src/sys/mdec/mtboot.s b/usr/src/sys/mdec/mtboot.s
new file mode 100644 (file)
index 0000000..2944ac1
--- /dev/null
@@ -0,0 +1,217 @@
+/*     mtboot.s        6.1     83/07/29        */
+
+/*
+ * VAX tape boot block for distribution tapes
+ * works on massbys tu78
+ *
+ * reads a program from a tp directory on a tape and executes it
+ * program must be stripped of the header and is loaded ``bits as is''
+ * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
+ *
+ * Based on similar driver for tm03 formatter.
+ * Local modifications by Jeffrey R. Schwab    June, 1982
+ *                             Purdue University Computing Center
+ */
+       .set    RELOC,0x70000
+/* a.out defines */
+       .set    HDRSIZ,040      /* size of file header for VAX */
+       .set    MAGIC,0410      /* file type id in header */
+       .set    TSIZ,4          /* text size */
+       .set    DSIZ,8          /* data size */
+       .set    BSIZ,12         /* bss size */
+       .set    TENT,024        /* task header entry loc */
+/* tp directory definitions */
+       .set    FILSIZ,38       /* tp direc offset for file size */
+       .set    BNUM,44         /* tp dir offset for start block no. */
+       .set    ENTSIZ,64       /* size of 1 TP dir entry, bytes */
+       .set    PTHSIZ,32       /* size of TP path name, bytes */
+       .set    BLKSIZ,512      /* tape block size, bytes */
+       .set    NUMDIR,24       /* no. of dir blocks on tape */
+       .set    ENTBLK,8        /* no. of dir entries per tape block */
+/* processor registers and bits */
+       .set    RXCS,32
+       .set    RXDB,33
+       .set    TXCS,34
+       .set    TXDB,35
+       .set    RXCS_DONE,0x80
+       .set    TXCS_RDY,0x80
+       .set    TXCS_pr,7       /* bit position of TXCS ready bit */
+       .set    RXCS_pd,7       /* bit position of RXCS done bit */
+/* MBA registers */
+       .set    MBA_CSR,0       /* configuration and status register */
+       .set    MBA_CR,4        /* MBA control reg */
+       .set    MBA_SR,8        /* MBA status reg */
+       .set    MBA_VAR,12      /* MBA virt addr reg */
+       .set    MBA_BCR,16      /* MBA byte count reg */
+       .set    MBA_MAP,0x800   /* start of MBA map reg's */
+       .set    MRV,0x80000000
+       .set    MBA_bsy,31      /* massbus busy */
+/* TU78 mba registers */
+       .set    MTCS,0          /* MT data transfer control reg */
+       .set    MTER,4          /* data transfer error status reg */
+       .set    MTRC,8          /* record count */
+       .set    MTAS,16         /* attention summary */
+       .set    MTBC,20         /* byte count */
+       .set    MTNER,44        /* non data transfer error status reg */
+       .set    MTNCS,48        /* non data transfer control reg */
+       .set    MTID,68         /* internal data reg */
+/* MT commands */
+       .set    GO,1            /* GO bit */
+       .set    MT_REW,6        /* rewind, on-line */
+       .set    MT_RCOM,070     /* read forward */
+/* MT bits */
+       .set    MT_rdy,15       /* controller ready */
+       .set    MT_rec,2        /* bit for single record count */
+       .set    MT_rcnt,4       /* record count for single record (shifted) */
+       .set    MT_erc,0xffffffc0       /* error code mask */
+       .set    MT_done,1       /* proper completion code */
+/* local stack variables */
+       .set    tapa,-4         /* desired tape addr */
+       .set    mtapa,-8        /* current tape addr */
+       .set    name,-8-PTHSIZ  /* operator-typed file name */
+/* register usage */
+       .set    rMBA,r10
+       .set    rMT,r11
+
+/* initialization */
+init:
+       mull2   $0x80,%rMT
+       addl2   $0x400,%rMT
+       addl2   %rMBA,%rMT
+       movl    $RELOC,fp       /* core loc to which to move this program */
+       addl3   $name,fp,sp     /* set stack pointer, leaving room for locals */
+       clrl    r0
+1:
+       movc3   $end,(r0),(fp)  /* move boot up to relocated position */
+       jmp     start+RELOC
+start:
+       movl    $1,MBA_CR(%rMBA)        /* MBA init */
+1:
+       movl    MTID(%rMT),r2           /* wait for tape controller to ready */
+       bbc     $MT_rdy,r2,1b           /* after massbus init */
+       bsbw    rew                     /* rewind input tape */
+       movab   name(fp),r4             /* start of filename storage */
+       movzbl  $'=,r0                  /* prompt character */
+       bsbw    putc                    /* output char to main console */
+/* read in a file name */
+       movl    r4,r1                   /* loc at which to store file name */
+nxtc:
+       bsbw    getc                    /* get input char's in file name */
+       cmpb    r0,$012                 /* terminator ? */
+       beql    nullc
+       movb    r0,(r1)+
+       brb     nxtc
+nullc:
+       subl3   r4,r1,r9                /* size of path name */
+       beql    start                   /* dumb operator */
+       clrb    (r1)+
+       incl    r9
+/* user-specified TP filename has been stored at name(fp) */
+/* read in entire tp directory contents into low core */
+dirred:
+       movl    $8,tapa(fp)             /* tp directory starts at block 8 */
+       movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
+       bsbw    taper                   /* read no. bytes indicated */
+/* search entire directory for user-specified file name */
+       clrl    r5                      /* dir buff loc = 0 */
+nxtdir:
+       cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
+       beql    fndfil                  /* found match */
+       acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
+                                       /* see if done with tp dir */
+       brw     start                   /* entry not in directory; start over */
+/* found desired tp dir entry */
+fndfil:
+       movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
+       addl2   $7,tapa(fp)             /* skip 7 boot blocks */
+       movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
+       insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
+       cmpl    r6,$RELOC-512           /* check if file fits below stack */
+       blss    filok                   /* file o.k. */
+       brw     start                   /* file too large */
+/* time to read in desired file from tape */
+filok:
+       movl    r6,r7                   /* save r6 */
+       bsbb    taper
+       bsbw    rew
+/* clear core */
+       subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
+1:
+       clrb    (r7)+
+       sobgtr  r0,1b
+/* time to jump to start of file & execute */
+       addl3   $20,fp,ap
+       clrl    r5
+       calls   $0,(r5)
+       brw     start
+/* taper: movcTAPE (r6),tapa(fp),0 */
+rew2:
+       bsbb    rew                     /* beginning of tape */
+taper0:
+       bsbb    rrec                    /* advance 1 block; never want blk0 */
+taper:
+       clrl    r0                      /* page no. */
+       cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
+       bgtr    rew2
+       blss    taper0
+1:
+       bsbb    rrec
+       acbl    $1,$-BLKSIZ,r6,1b
+       rsb
+/* rew: rewind the tape */
+rew:
+       clrl    mtapa(fp)               /* current position */
+       movl    MTNER(%rMT),r2          /* read non-data status */
+       movl    MTAS(%rMT),MTAS(%rMT)   /* and clear any attention bits */
+       movl    $MT_REW+GO,MTNCS(%rMT)  /* rewind command and go bit */
+1:
+       movl    MTAS(%rMT),r2           /* check attention bits */
+       beql    1b                      /* loop if attention not yet set */
+       movl    MTNER(%rMT),r2          /* read non-data status */
+       movl    MTAS(%rMT),MTAS(%rMT)   /* and clear any attention bits */
+       bicl2   $MT_erc,r2              /* isolate error condition */
+       subl2   $MT_done,r2             /* check with completion condition */
+       bneq    1b                      /* wait for completion attention */
+       rsb
+/* rrec: read 1 block from mag tape into page (r0) */
+rrec:
+       /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
+       movl    MTNER(%rMT),r2          /* read non-data status */
+       movl    MTAS(%rMT),MTAS(%rMT)   /* and clear any attention bits */
+       movl    $-BLKSIZ,MBA_BCR(%rMBA)
+       bisl3   $MRV,r0,MBA_MAP(%rMBA)
+       clrl    MBA_VAR(%rMBA)
+       movl    $BLKSIZ,MTBC(%rMT)      /* set byte count */
+       bisl2   $MT_rcnt,MTRC(%rMT)     /* set record count */
+       movl    $MT_RCOM+GO,MTCS(%rMT)  /* load read command */
+1:
+       movl    MBA_SR(%rMBA),r2        /* load mba status reg */
+       bbs     $MBA_bsy,r2,1b          /* wait for mba to go non-busy */
+       movl    MTRC(%rMT),r2           /* fetch record count */
+       bbs     $MT_rec,r2,rrec         /* retry read if we did not read a record */
+       movl    MTER(%rMT),r2           /* load data transfer error status */
+       bicl2   $MT_erc,r2              /* isolate status value */
+       subl2   $MT_done,r2             /* compare with successful read */
+       bneq    rrec                    /* load to try read again */
+
+       incl    r0                      /* next page no. */
+       incl    mtapa(fp)               /* mag tape block position */
+       rsb
+getc:
+       mfpr    $RXCS,r0
+       bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
+       mfpr    $RXDB,r0
+       extzv   $0,$7,r0,r0
+       cmpb    r0,$015
+       bneq    putc
+       bsbb    putc
+       movb    $0,r0
+       bsbb    putc
+       movb    $012,r0
+putc:
+       mfpr    $TXCS,r2
+       bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
+       extzv   $0,$7,r0,r0
+       mtpr    r0,$TXDB
+       rsb
+end:
diff --git a/usr/src/sys/mdec/mttoggle.s b/usr/src/sys/mdec/mttoggle.s
new file mode 100644 (file)
index 0000000..c2accb8
--- /dev/null
@@ -0,0 +1,25 @@
+/*     mttoggle.s      6.1     83/07/29        */
+
+/*
+ * Prototype toggle in bootstrap code for mt type tapes.
+ * If on anything but a 780 with a tape at drive 0 of mba 1
+ * this will have to be repaired by patching mba and mt.
+ */
+       movl    mba,r10
+       mull3   mt,$0x80,r11
+       addl3   r11,r10,r11
+       addl2   $0x400,r11
+       movzbl  $1,4(r10)
+       movzbl  $4,8(r11)               /* drive zero, one record */
+       clrl    12(r10)                 /* set address to zero */
+       movl    $0x80000000,0x800(r10)  /* validate map register */
+       cvtwl   $-512,16(r10)           /* set byte count */
+       movzwl  $512,20(r11)            /* set byte count */
+0:
+       movl    0x44(r11),r0
+       bbc     $15,r0,0b
+       movzbl  $071,(r11)              /* read forward, go */
+       halt
+       .align  2
+mba:   .long   0x20012000
+mt:    .long   0
diff --git a/usr/src/sys/mdec/raboot.s b/usr/src/sys/mdec/raboot.s
new file mode 100644 (file)
index 0000000..e536353
--- /dev/null
@@ -0,0 +1,56 @@
+/*     raboot.s        6.1     83/07/29        */
+
+/*
+ * UDA50 1st level boot program: loads next 7.5Kbytes from
+ * boot sector of file system and sets it up to run.
+ */
+       .set    RELOC,0x50000
+       .set    BOOTLAST,15             /* last boot sector */
+       .set    RABPSECT,512            /* bytes per sector */
+
+init:
+       .word   0                       /* entry mask for dec monitor */
+       nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
+       nop;nop;
+start:
+       movl    r1,r7                   /* UNIBUS I/O page address */
+       movl    r2,r8                   /* boot device CSR */
+       movl    r3,r9                   /* unit number */
+       movl    r5,r11                  /* boot flags */
+       movl    $RELOC,sp
+       moval   init,r10
+       movc3   $end,(r10),(sp)
+       movl    r7,r1                   /* UNIBUS I/O page address */
+       movl    r8,r2                   /* boot device CSR */
+       movl    r9,r3                   /* unit number */
+       jmp     *$RELOC+start2
+/* now running relocated */
+/* bring in the boot program */
+start2:                                        /* running relocated */
+       pushr   $0xffff                 /* BEGIN FIREWALL */
+       movl    $1,r4                   /* first boot sector */
+       clrl    r5                      /* transfer address */
+       clrl    -(sp)                   /* transfer address */
+1:
+       movl    r4,r8                   /* requested sector # */
+       jsb     (r6)                    /* call ROM-based driver */
+       blbs    r0,2f
+       halt                            /* read error */
+2:
+       addl2   $RABPSECT,r5            /* bump address */
+       movl    r5,(sp)
+       aobleq  $BOOTLAST,r4,1b
+
+       .set    PROGSIZE,((BOOTLAST-1)*RABPSECT)
+done:
+       tstl    (sp)+                   /* pop address */
+       popr    $0xffff                 /* END FIREWALL */
+       movl    $PROGSIZE,r3
+clrcor:
+       clrq    (r3)
+       acbl    $RELOC,$8,r3,clrcor
+/* start loaded program */
+       movl    $9,r10                  /* major("/dev/ra0a") */
+       calls   $0,*$0
+       brw     start2
+end:
diff --git a/usr/src/sys/mdec/rlboot.s b/usr/src/sys/mdec/rlboot.s
new file mode 100644 (file)
index 0000000..412d4e6
--- /dev/null
@@ -0,0 +1,112 @@
+/*     rlboot.s        6.1     83/07/29        */
+
+/*
+ * RL02 1st level boot program: loads next 7.5Kbytes from
+ * boot sector of file system and sets it up to run.
+ * Always reads from drive 0.
+ *     UNTESTED
+ */
+       .set    BOOTSIZE,15             /* 15 ``sectors'' */
+        .set    RELOC,0x50000
+        .set    SID,62                 /* system ID register */
+/* UBA registers */
+        .set    UBA_CNFGR,0            /* UBA configuration register */
+        .set    UBA_CR,4               /* UBA control register offset */
+        .set    UBA_MAP,0x800          /* UBA offset to map reg's */
+        .set    UBAinit,1              /* UBA init bit in UBA control reg */
+        .set    pUBIC,16               /* Unibus init complete */
+/* RL11 registers and bits */
+        .set    HL,0174400-0160000     /* address of RL11 */
+        .set    HLBPSECT,512           /* sector size in bytes (kludge) */
+        .set    HL_cs,HL+0             /* control and status */
+        .set    HL_ba,HL+2             /* bus address */
+        .set    HL_da,HL+4             /* disk address */
+        .set    HL_wc,HL+6             /* word count */
+        .set    HL_GO,0                        /* go bit */
+        .set    HL_RCOM,014            /* read command */
+        .set    HL_SEEK,06             /* seek */
+        .set    HL_RESET,013           /* reset drive */
+        .set    HL_GSTAT,04            /* get status command */
+        .set    HL_pRDY,7              /* position of ready bit */
+        .set    HL_pERR,15             /* position of error bit */
+
+init:
+/* r9   UBA address */
+/* r10  umem addr */
+        .word   0                      /* entry mask for dec monitor */
+        nop;nop;nop;nop;nop;nop;nop;nop        /* some no-ops for 750 boot to skip */
+       nop;nop;
+/* get cpu type and find the first uba */
+        mfpr    $SID,r0
+        extzv   $24,$8,r0,r0           /* get cpu type */
+        ashl    $2,r0,r1
+        movab   physUBA,r2             /* get physUBA[cpu] */
+        addl2   r1,r2
+        movl    (r2),r9
+        movab   physUMEM,r2            /* get physUMEM[cpu] */
+        addl2   r1,r2
+        movl    (r2),r10
+/* if 780, init uba */
+        cmpl    r0,$1
+        bneq    2f
+        movl    $UBAinit,UBA_CR(r9)
+1:
+        bbc     $pUBIC,UBA_CNFGR(r9),1b
+2:
+/* init rl11, and drive 0, don't check for any errors now */
+        movw    $HL_RESET,HL_da(r10)
+        movw    $HL_GSTAT+HL_GO,HL_cs(r10)
+/* relocate to high core */
+start:
+        movl    r5,r11                 /* save boot flags */
+        movl    $RELOC,sp
+        moval   init,r6
+        movc3   $end,(r6),(sp)
+        jmp     *$RELOC+start2
+/* now running relocated */
+/* read in the boot program */
+       .set    PROGSIZE,(BOOTSIZE*HLBPSECT)
+start2:
+       movw    $1,HL_da(r10)                   /* seek to cylinder 0 */
+       movw    $HL_SEEK+HL_GO,HL_cs(r10)
+1:
+        movw    HL_cs(r10),r0
+        bbc     $HL_pRDY,r0,1b
+        bbs     $HL_pERR,r0,hlerr
+       /* Rl has 256 byte sectors */
+       movw    $2,HL_da(r10)                   /* read program */
+       movw    $-PROGSIZE/2,HL_wc(r10)
+       clrl    r0
+1:
+       bisl3   $0x80000000,r0,UBA_MAP(r9)
+       addl2   $4,r9
+       aobleq  $BOOTSIZE,r0,1b
+       clrw    HL_ba(r10)
+       movw    $HL_RCOM+HL_GO,HL_cs(r10)
+1:
+        movw    HL_cs(r10),r0
+        bbc     $HL_pRDY,r0,1b
+        bbs     $HL_pERR,r0,hlerr
+       brw     done
+hlerr:
+        halt                           /* ungraceful */
+done:
+        movl    $PROGSIZE,r3
+clrcor:
+        clrq    (r3)
+        acbl    $RELOC,$8,r3,clrcor
+/* run loaded program */
+        movl    $14,r10                        /* major("/dev/hl0a") */
+        calls   $0,*$0
+        brw     start2
+physUBA:
+        .long   0
+        .long   0x20006000             /* 11/780 */
+        .long   0xf30000               /* 11/750 */
+        .long   0xf26000               /* 11/730 */
+physUMEM:
+        .long   0
+        .long   0x2013e000             /* 11/780 */
+        .long   0xffe000               /* 11/750 */
+        .long   0xffe000               /* 11/730 */
+end:
diff --git a/usr/src/sys/mdec/tmboot.s b/usr/src/sys/mdec/tmboot.s
new file mode 100644 (file)
index 0000000..e8eada4
--- /dev/null
@@ -0,0 +1,192 @@
+/*     tmboot.s        6.1     83/07/29        */
+
+/*
+ * VAX tape boot block for distribution tapes
+ * works on unibus tm03
+ *
+ * reads a program from a tp directory on a tape and executes it
+ * program must be stripped of the header and is loaded ``bits as is''
+ * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
+ */
+       .set    RELOC,0x70000
+/* a.out defines */
+       .set    HDRSIZ,040      /* size of file header for VAX */
+       .set    MAGIC,0410      /* file type id in header */
+       .set    TSIZ,4          /* text size */
+       .set    DSIZ,8          /* data size */
+       .set    BSIZ,12         /* bss size */
+       .set    TENT,024        /* task header entry loc */
+/*  tp directory definitions */
+       .set    FILSIZ,38       /* tp direc offset for file size */
+       .set    BNUM,44         /* tp dir offset for start block no. */
+       .set    ENTSIZ,64       /* size of 1 TP dir entry, bytes */
+       .set    PTHSIZ,32       /* size of TP path name, bytes */
+       .set    BLKSIZ,512      /* tape block size, bytes */
+       .set    NUMDIR,24       /* no. of dir blocks on tape */
+       .set    ENTBLK,8        /* no. of dir entries per tape block */
+/* processor registers and bits */
+       .set    RXCS,32
+       .set    RXDB,33
+       .set    TXCS,34
+       .set    TXDB,35
+       .set    RXCS_DONE,0x80
+       .set    TXCS_RDY,0x80
+       .set    TXCS_pr,7       /* bit position of TXCS ready bit */
+       .set    RXCS_pd,7       /* bit position of RXCS done bit */
+/* UBA registers */
+       .set    UBA_DPR1,68
+       .set    UBA_MAP,2048
+       .set    BNE,0x80000000
+       .set    MRV,0x80000000
+       .set    MR_BDP1,0x200000
+/* TM UBA registers */
+       .set    TMER,0
+       .set    TMCS,2
+       .set    TMBC,4
+       .set    TMBA,6
+/* TM commands and bits */
+       .set    GO,1
+       .set    TM_REW,016
+       .set    TM_RCOM,02
+       .set    TM_SREV,012
+       .set    TM_DCLR,010000
+       .set    TM_crdy,7
+       .set    TM_gapsd,3
+       .set    TMDENS,0                /* 1600 bpi */
+/* local stack variables */
+       .set    tapa,-4         /* desired tape addr */
+       .set    mtapa,-8        /* current tape addr */
+       .set    name,-8-PTHSIZ  /* operator-typed file name */
+/* register usage */
+       .set    rUBA,r10
+       .set    rTM,r11
+/* ===== */
+
+/* initialization */
+init:
+       movl    $RELOC,fp       /* core loc to which to move this program */
+       addl3   $name,fp,sp     /* set stack pointer; leave room for locals */
+       clrl    r0
+1:
+       movc3   $end,(r0),(fp)  /* move boot up to relocated position */
+       jmp     start+RELOC
+start:
+       bsbw    rew                     /* rewind input tape */
+       movab   name(fp),r4             /* start of filename storage */
+       movzbl  $'=,r0                  /* prompt character */
+       bsbw    putc                    /* output char to main console */
+/* read in a file name */
+       movl    r4,r1                   /* loc at which to store file name */
+nxtc:
+       bsbw    getc                    /* get input char's in file name */
+       cmpb    r0,$012                 /* terminator ? */
+       beql    nullc
+       movb    r0,(r1)+
+       brb     nxtc
+nullc:
+       subl3   r4,r1,r9                /* size of path name */
+       beql    start                   /* dumb operator */
+       clrb    (r1)+
+       incl    r9
+/* user-specified TP filename has been stored at name(fp) */
+/* read in entire tp directory contents into low core */
+dirred:
+       movl    $8,tapa(fp)             /* tp directory starts at block 8 */
+       movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
+       bsbw    taper                   /* read no. bytes indicated */
+/* search entire directory for user-specified file name */
+       clrl    r5                      /* dir buff loc = 0 */
+nxtdir:
+       cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
+       beql    fndfil                  /* found match */
+       acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
+                                       /* see if done with tp dir */
+       brw     start                   /* entry not in directory; start over */
+/* found desired tp dir entry */
+fndfil:
+       movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
+       addl2   $7,tapa(fp)             /* skip 7 boot blocks */
+       movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
+       insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
+       cmpl    r6,$RELOC-512           /* check if file fits below stack */
+       blss    filok                   /* file o.k. */
+       brw     start                   /* file too large */
+/* time to read in desired file from tape */
+filok:
+       movl    r6,r7                   /* save r6 */
+       bsbb    taper
+       bsbw    rew
+/* clear core */
+       subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
+1:
+       clrb    (r7)+
+       sobgtr  r0,1b
+/* time to jump to start of file & execute */
+       addl3   $20,fp,ap
+       clrl    r5
+       calls   $0,(r5)
+       brw     start
+/* taper: movcTAPE (r6),tapa(fp),0 */
+rew2:
+       bsbb    rew                     /* beginning of tape */
+taper0:
+       bsbb    rrec                    /* advance 1 block; never want blk 0 */
+taper:
+       clrl    r0                      /* page no. */
+       cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
+       bgtr    rew2
+       blss    taper0
+1:
+       bsbb    rrec
+       acbl    $1,$-BLKSIZ,r6,1b
+       rsb
+/* rew: rewind the tape */
+rew:
+       clrl    mtapa(fp)               /* current position */
+       movw    $TM_REW+TMDENS+GO,TMCS(%rTM)
+       rsb
+/* rrec: read 1 block from mag tape into page (r0) */
+rrec:
+       /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
+       jsb     tmquiet
+       movw    $-BLKSIZ,TMBC(%rTM)
+       bisl3   $MRV|MR_BDP1,r0,UBA_MAP(%rUBA)
+       movw    $0,TMBA(%rTM)
+       movw    $TM_RCOM+TMDENS+GO,TMCS(%rTM)
+       jsb     tmquiet
+       bisl2   $BNE,UBA_DPR1(%rUBA)
+       tstw    TMER(%rTM)
+       jgeq    2f
+       mnegw   $1,TMBC(%rTM)
+       movw    $TM_SREV+TMDENS+GO,TMCS(%rTM)
+       jmp     rrec
+2:
+       incl    r0                      /* next page no. */
+       incl    mtapa(fp)               /* mag tape block position */
+       rsb
+getc:
+       mfpr    $RXCS,r0
+       bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
+       mfpr    $RXDB,r0
+       extzv   $0,$7,r0,r0
+       cmpb    r0,$015
+       bneq    putc
+       bsbb    putc
+       movb    $0,r0
+       bsbb    putc
+       movb    $012,r0
+putc:
+       mfpr    $TXCS,r2
+       bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
+       extzv   $0,$7,r0,r0
+       mtpr    r0,$TXDB
+       rsb
+tmquiet:
+       movw    TMCS(%rTM),r2
+       bbc     $TM_crdy,r2,tmquiet
+1:
+       movw    TMER(%rTM),r2
+       blbc    r2,1b                   /* low bit == TUR */
+       bbs     $TM_gapsd,r2,1b
+       rsb
+end:
diff --git a/usr/src/sys/mdec/tmtoggle.s b/usr/src/sys/mdec/tmtoggle.s
new file mode 100644 (file)
index 0000000..8ecb2de
--- /dev/null
@@ -0,0 +1,20 @@
+/*     tmtoggle.s      6.1     83/07/29        */
+
+/*
+ * Prototype toggle in bootstrap code for tm type tapes.
+ * If on anything but a 780 with the drive on uba0
+ * this will have to be repaired by patching uba and umem.
+ */
+begin:
+       movl    uba,r1
+       movl    $0x80200000,0x800(r1)
+       clrl    0x804(r1)
+       movl    umem,r2
+       bisl2   $0172520,r2
+       mnegw   $512,4(r2)
+       clrw    6(r2)
+       movw    $03,2(r2)
+       halt
+       .align  2
+uba:   .long   0x20006000
+umem:  .long   0x2013e000
diff --git a/usr/src/sys/mdec/tsboot.s b/usr/src/sys/mdec/tsboot.s
new file mode 100644 (file)
index 0000000..a6164cb
--- /dev/null
@@ -0,0 +1,209 @@
+/*     tsboot.s        6.1     83/07/29        */
+
+/*
+ * VAX tape boot block for distribution tapes
+ * works on unibus ts11
+ *
+ * reads a program from a tp directory on a tape and executes it
+ * program must be stripped of the header and is loaded ``bits as is''
+ * you can return to this loader via ``ret'' as you are called ``calls $0,ent''
+ */
+       .set    RELOC,0x70000
+/* a.out defines */
+       .set    HDRSIZ,040      /* size of file header for VAX */
+       .set    MAGIC,0410      /* file type id in header */
+       .set    TSIZ,4          /* text size */
+       .set    DSIZ,8          /* data size */
+       .set    BSIZ,12         /* bss size */
+       .set    TENT,024        /* task header entry loc */
+/*  tp directory definitions */
+       .set    FILSIZ,38       /* tp direc offset for file size */
+       .set    BNUM,44         /* tp dir offset for start block no. */
+       .set    ENTSIZ,64       /* size of 1 TP dir entry, bytes */
+       .set    PTHSIZ,32       /* size of TP path name, bytes */
+       .set    BLKSIZ,512      /* tape block size, bytes */
+       .set    NUMDIR,24       /* no. of dir blocks on tape */
+       .set    ENTBLK,8        /* no. of dir entries per tape block */
+/* processor registers and bits */
+       .set    RXCS,32
+       .set    RXDB,33
+       .set    TXCS,34
+       .set    TXDB,35
+       .set    RXCS_DONE,0x80
+       .set    TXCS_RDY,0x80
+       .set    TXCS_pr,7       /* bit position of TXCS ready bit */
+       .set    RXCS_pd,7       /* bit position of RXCS done bit */
+/* UBA registers */
+       .set    UBA_DPR1,68
+       .set    UBA_MAP,2048
+       .set    BNE,0x80000000
+       .set    MRV,0x80000000
+       .set    MR_BDP1,0x200000
+/* TS UBA registers */
+       .set    TSDB,0
+       .set    TSSR,2
+/* TS commands and bits */
+       .set    TSA,0x200       /* page 1, ts command buffer relocation */
+       .set    TS_ACK,0100000  /* ack packet */
+       .set    TS_CVC,040000   /* clear volume check */
+       .set    TS_SETCHR,4     /* set characteristics */
+       .set    TS_READ,1       /* read */
+       .set    TS_RETRY,01000  /* retry, or with read */
+       .set    TS_REWIND,02010
+/* local stack variables */
+       .set    tapa,-4         /* desired tape addr */
+       .set    mtapa,-8        /* current tape addr */
+       .set    name,-8-PTHSIZ  /* operator-typed file name */
+/* register usage */
+       .set    rUBA,r10
+       .set    rTS,r11
+/* ===== */
+
+/* initialization */
+init:
+       movl    $RELOC,fp       /* core loc to which to move this program */
+       addl3   $name,fp,sp     /* set stack pointer; leave room for locals */
+       clrl    r0
+1:
+       movc3   $end,(r0),(fp)  /* move boot up to relocated position */
+       jmp     start+RELOC
+start:
+       ashl    $-9,$RELOC,r0
+       bisl3   $MRV,r0,UBA_MAP+4(%rUBA)
+       clrw    TSSR(%rTS)
+       bsbw    tsquiet
+       movw    $TSA+setchr,TSDB(%rTS)
+       bsbw    tsquiet
+       bsbw    rew                     /* rewind input tape */
+       movab   name(fp),r4             /* start of filename storage */
+       movzbl  $'=,r0                  /* prompt character */
+       bsbw    putc                    /* output char to main console */
+/* read in a file name */
+       movl    r4,r1                   /* loc at which to store file name */
+nxtc:
+       bsbw    getc                    /* get input char's in file name */
+       cmpb    r0,$012                 /* terminator ? */
+       beql    nullc
+       movb    r0,(r1)+
+       brb     nxtc
+nullc:
+       subl3   r4,r1,r9                /* size of path name */
+       beql    start                   /* dumb operator */
+       clrb    (r1)+
+       incl    r9
+/* user-specified TP filename has been stored at name(fp) */
+/* read in entire tp directory contents into low core */
+dirred:
+       movl    $8,tapa(fp)             /* tp directory starts at block 8 */
+       movl    $(NUMDIR*BLKSIZ),r6     /* no. bytes in total dir */
+       bsbw    taper                   /* read no. bytes indicated */
+/* search entire directory for user-specified file name */
+       clrl    r5                      /* dir buff loc = 0 */
+nxtdir:
+       cmpc3   r9,(r5),(r4)            /* see if dir entry matches filename */
+       beql    fndfil                  /* found match */
+       acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r5,nxtdir
+                                       /* see if done with tp dir */
+       brw     start                   /* entry not in directory; start over */
+/* found desired tp dir entry */
+fndfil:
+       movzwl  BNUM(r5),tapa(fp)       /* start block no., 2 bytes */
+       addl2   $7,tapa(fp)             /* skip 7 boot blocks */
+       movzwl  FILSIZ(r5),r6           /* low 2 bytes file size */
+       insv    FILSIZ-1(r5),$16,$8,r6  /* file size, high byte */
+       cmpl    r6,$RELOC-512           /* check if file fits below stack */
+       blss    filok                   /* file o.k. */
+       brw     start                   /* file too large */
+/* time to read in desired file from tape */
+filok:
+       movl    r6,r7                   /* save r6 */
+       bsbb    taper
+       bsbw    rew
+/* clear core */
+       subl3   r7,$RELOC-4,r0          /* no. bytes to clear */
+1:
+       clrb    (r7)+
+       sobgtr  r0,1b
+/* time to jump to start of file & execute */
+       addl3   $20,fp,ap
+       clrl    r5
+       calls   $0,(r5)
+       brw     start
+/* taper: movcTAPE (r6),tapa(fp),0 */
+rew2:
+       bsbb    rew                     /* beginning of tape */
+taper0:
+       bsbb    rrec                    /* advance 1 block; never want blk 0 */
+taper:
+       clrl    r0                      /* page no. */
+       cmpl    mtapa(fp),tapa(fp)      /* current position .vs. desired */
+       bgtr    rew2
+       blss    taper0
+1:
+       bsbb    rrec
+       acbl    $1,$-BLKSIZ,r6,1b
+       rsb
+/* rew: rewind the tape */
+rew:
+       clrl    mtapa(fp)               /* current position */
+       movw    $TSA+rewind,TSDB(%rTS)
+       bsbb    tsquiet
+       rsb
+/* rrec: read 1 block from mag tape into page (r0) */
+rrec:
+       /* pushl r0; movzbl $'r,r0; bsbw putc; movl (sp)+,r0; */
+       bisl3   $MRV,r0,UBA_MAP(%rUBA)
+       movw    $TS_ACK|TS_CVC|TS_READ,tsread
+1:
+       movw    $TSA+tsread,TSDB(%rTS)
+       bsbb    tsquiet
+/*     bisl2   $BNE,UBA_DPR1(%rUBA) */
+       tstw    TSSR(%rTS)
+       bgeq    2f
+       bisw2   $TS_RETRY,tsread
+       brb     1b
+2:
+       incl    r0                      /* next page no. */
+       incl    mtapa(fp)               /* mag tape block position */
+       rsb
+tsquiet:
+       tstb    TSSR(%rTS)
+       bgeq    tsquiet
+       rsb
+getc:
+       mfpr    $RXCS,r0
+       bbc     $RXCS_pd,r0,getc        /* receiver ready ? */
+       mfpr    $RXDB,r0
+       extzv   $0,$7,r0,r0
+       cmpb    r0,$015
+       bneq    putc
+       bsbb    putc
+       movb    $0,r0
+       bsbb    putc
+       movb    $012,r0
+putc:
+       mfpr    $TXCS,r2
+       bbc     $TXCS_pr,r2,putc        /* transmitter ready ? */
+       extzv   $0,$7,r0,r0
+       mtpr    r0,$TXDB
+       rsb
+       .align  2
+setchr:
+       .word   TS_ACK|TS_CVC|TS_SETCHR
+       .long   TSA+char
+       .word   0xe
+char:
+       .long   TSA+tsstat
+       .word   0xe
+       .word   0
+tsread:
+       .word   TS_ACK|TS_CVC|TS_READ
+       .long   0
+       .word   BLKSIZ
+rewind:
+       .word   TS_ACK|TS_CVC|TS_REWIND
+       .long   0
+       .word   0
+tsstat:
+       .space  7*2
+end:
diff --git a/usr/src/sys/mdec/tstoggle.s b/usr/src/sys/mdec/tstoggle.s
new file mode 100644 (file)
index 0000000..1091e7d
--- /dev/null
@@ -0,0 +1,33 @@
+/*     tstoggle.s      6.1     83/07/29        */
+
+/*
+ * Prototype toggle in bootstrap code for ts type tapes.
+ * If on anything but a 780 with the drive on uba0
+ * this will have to be repaired by patching uba and umem.
+ */
+       .set    UBA0,0x20006000
+       .set    UMEM0,0x2013e000
+       .set    UBA_MAP,0x800
+       .set    TSADDR,0772520-0760000
+
+start:
+       movl    uba,r10
+       movl    mrv,UBA_MAP(r10)
+       addl3   mrv,$1,UBA_MAP+4(r10)
+       addl3   umem,$TSADDR,r11
+       clrw    2(r11)
+1:     tstb    2(r11)
+       bgeq    1b
+       movw    $0x200+setchr,(r11)
+1:     tstb    2(r11)
+       bgeq    1b
+       movw    $0x200+read,(r11)
+       halt
+       .align  2
+uba:   .long   UBA0
+umem:  .long   UMEM0
+mrv:   .long   0x80000000
+setchr:        .word   0xc004,0x200+char,0,0x8 # set characteristics command
+char:  .word   0x200+status,0,0xe,0    # characteristics
+read:  .word   0xc001,0,0,0x200        # read command
+status:
diff --git a/usr/src/sys/mdec/upboot.s b/usr/src/sys/mdec/upboot.s
new file mode 100644 (file)
index 0000000..26494ae
--- /dev/null
@@ -0,0 +1,112 @@
+/*     upboot.s        6.1     83/07/29        */
+
+/*
+ * UP 1st level boot program: loads next 7.5Kbytes from
+ * boot sector of file system and sets it up to run.
+ * Always reads from drive 0.
+ */
+       .set    BOOTSIZE,15             /* size of boot in sectors */
+       .set    RELOC,0x50000
+       .set    UPBPSECT,512            /* bytes per sector */
+       .set    SID,62                  /* system ID register */
+/* UBA registers */
+       .set    UBA_CNFGR,0             /* UBA configuration register */
+       .set    UBA_CR,4                /* UBA control register offset */
+       .set    UBA_MAP,0x800           /* UBA offset to map reg's */
+       .set    UBAinit,1               /* UBA init bit in UBA control reg */
+       .set    pUBIC,16                /* Unibus init complete */
+/* UP registers and bits */
+       .set    UP,0176700-0160000      /* address of UP controller */
+       .set    UP_cs1,UP+0             /* control and status */
+       .set    UP_wc,UP+2              /* word count */
+       .set    UP_ba,UP+4              /* bus address */
+       .set    UP_da,UP+6              /* disk address */
+       .set    UP_cs2,UP+010           /* cs2 register */
+       .set    UP_of,UP+032            /* offset register */
+       .set    UP_dc,UP+034            /* desired cylinder */
+       .set    UP_hr,UP+036            /* holding register */
+       .set    UP_GO,1                 /* go bit */
+       .set    UP_PACK,022             /* pack acknowledge */
+       .set    UP_DCLR,010             /* drive clear */
+       .set    UP_PRESET,020           /* read-in-preset */
+       .set    UP_RCOM,070             /* read command */
+       .set    UPCS2_CLR,040
+       .set    UP_pRDY,7               /* position of ready bit */
+       .set    UP_pERR,15              /* position of error bit */
+       .set    UP_FMT22,010000
+
+init:
+       .word   0                       /* entry mask for dec monitor */
+       nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
+       nop;nop;
+/* get cpu type and find the first uba */
+       mfpr    $SID,r0
+       extzv   $24,$8,r0,r0            /* get cpu type */
+       ashl    $2,r0,r1
+       movab   physUBA,r2              /* get physUBA[cpu] */
+       addl2   r1,r2
+       movl    (r2),r9
+       movab   physUMEM,r2             /* get physUMEM[cpu] */
+       addl2   r1,r2
+       movl    (r2),r10
+/* if 780, init uba */
+       cmpl    r0,$1
+       bneq    2f
+       movl    $UBAinit,UBA_CR(r9)
+1:
+       bbc     $pUBIC,UBA_CNFGR(r9),1b
+2:
+       movl    $5000000,r0
+1:
+       sobgtr  r0,1b
+/* init up, set vv in drive 0; if any errors, give up */
+       movw    $UPCS2_CLR,UP_cs2(r10)
+       movw    $UP_DCLR+UP_GO,UP_cs1(r10)
+       movw    $UP_PRESET+UP_GO,UP_cs1(r10)
+       movw    $UP_FMT22,UP_of(r10)
+1:
+       movw    UP_cs1(r10),r0
+       bbc     $UP_pRDY,r0,1b
+/* relocate to high core */
+start:
+       movl    r5,r11                  /* boot flags */
+       movl    $RELOC,sp
+       moval   init,r6
+       movc3   $end,(r6),(sp)
+       jmp     *$RELOC+start2
+/* now running relocated */
+       .set    PROGSIZE,(BOOTSIZE*UPBPSECT)
+start2:
+       movw    $0,UP_dc(r10)
+       movw    $1,UP_da(r10)
+       movw    $-PROGSIZE/2,UP_wc(r10)
+       clrl    r0
+1:
+       bisl3   $0x80000000,r0,UBA_MAP(r9)
+       addl2   $4,r9
+       aobleq  $BOOTSIZE,r0,1b
+       clrw    UP_ba(r10)
+       movw    $UP_RCOM+UP_GO,UP_cs1(r10)
+uprdy:
+       movw    UP_cs1(r10),r0
+       bbc     $UP_pRDY,r0,uprdy
+clear:
+       movl    $PROGSIZE,r3
+clrcor:
+       clrq    (r3)
+       acbl    $RELOC,$8,r3,clrcor
+/* run loaded program */
+       movl    $2,r10                  /* major("/dev/up0a") */
+       calls   $0,*$0
+       brw     start2
+physUBA:
+       .long   0
+       .long   0x20006000      /* 11/780 */
+       .long   0xf30000        /* 11/750 */
+       .long   0xf26000        /* 11/730 */
+physUMEM:
+       .long   0
+       .long   0x2013e000      /* 11/780 */
+       .long   0xffe000        /* 11/750 */
+       .long   0xffe000        /* 11/730 */
+end:
diff --git a/usr/src/sys/mdec/uttoggle.s b/usr/src/sys/mdec/uttoggle.s
new file mode 100644 (file)
index 0000000..bfa48c6
--- /dev/null
@@ -0,0 +1,22 @@
+/*     uttoggle.s      6.1     83/07/29        */
+
+/*
+ * Prototype toggle in bootstrap code for ut type tapes.
+ * If on anything but a 780 with the drive on uba0
+ * this will have to be repaired by patching uba and umem.
+ */
+begin:
+       movl    uba,r1
+       movl    $0x80200000,0x800(r1)
+       clrl    0x804(r1)
+       movl    umem,r2
+       bisl2   $0172440,r2
+       movw    $0x04c0,26(r2)          /* set tape density & format */
+       mnegw   $512,6(r2)              /* set frame count */
+       mnegw   $256,2(r2)              /* set word count */
+       clrw    4(r2)                   /* set bus address */
+       movw    $0x39,(r2)              /* set command and go */
+       halt
+       .align  2
+uba:   .long   0x20006000
+umem:  .long   0x2013e000