1: /*
   2:  * Copyright (c) 1980,1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: /* "@(#)hpboot.s	7.1 (Berkeley) 6/5/86" */
   8: 
   9: 
  10: #define PARTITION               /* Partition is in bits 12 to 15 of R5
  11: 
  12: /*
  13:  * RP??/RM?? 1st level boot program: loads next 7.5Kbytes from
  14:  * boot sectors of file system and sets it up to run.
  15:  * Reads from the controller and drive passed in from the boot
  16:  * rom.
  17:  *   R1:  address of the boot device's adapter
  18:  *   R2:  controller number of the boot device
  19:  *   R3:  unit number of the boot device
  20:  *   R5:  software boot control flags
  21:  *   R6:  address of driver subroutine from ROM
  22:  *   SP:  base address of usable memory + 0x200
  23:  */
  24:         .set    BOOTSIZE,15             /* size of boot in sectors */
  25:         .set    RELOC,0x70000
  26: /* MBA registers */
  27:         .set    M_cr,4                  /* MBA control reg */
  28:         .set    M_sr,8                  /* MBA status reg */
  29:         .set    M_var,12                /* MBA virt addr reg */
  30:         .set    M_bc,16                 /* MBA byte count reg */
  31:         .set    M_map,0x800             /* start of MBA map reg's */
  32:         .set    MBAinit,1               /* MBA init bit in MBA control reg */
  33:         .set    MBABUSY,0x80000000      /* MBA SR: data transfer busy */
  34:         .set    pMBABUSY,31             /* bit position of  MBABUSY */
  35: /* Drive information */
  36:         .set    RP,0x400                /* start of drive registers */
  37:         .set    RPDR,0x80               /* offset per drive unit */
  38:         .set    RP_cr,0                 /* control status register */
  39:         .set    RP_sr,4                 /* drive status reg */
  40:         .set    RP_stk,0x14             /* desired track/sector reg */
  41:         .set    RP_dt,0x18              /* drive type reg */
  42:         .set    RP_off,0x24             /* RP offset reg */
  43:         .set    RP_cyl,0x28             /* desired cyl reg */
  44:         .set    RPBPSECT,512            /* bytes per sector */
  45: /* RP?? function codes, status bits  */
  46:         .set    RP_GO,1                 /* go */
  47:         .set    RP_RED,070              /* read */
  48:         .set    RP_DC,010               /* drive clear */
  49:         .set    RP_RIP,020              /* read in preset */
  50:         .set    RP_FMT,0x1000           /* format 22 */
  51:         .set    RP_MOL,0x1000           /* medium on line */
  52:         .set    RP_DRY,0200             /* drive ready */
  53:         .set    RP_ERR,040000           /* composite error */
  54:         .set    RP_pDRY,7               /* bit position of RP_DRY */
  55:         .set    RP_pERR,14              /* bit position of RP_ERR */
  56: 
  57: init:
  58:         .word   0                       /* entry mask for DEC monitor */
  59:         nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
  60:         nop;nop;
  61: start:
  62:         clrl    r10                     /* major("/dev/hp0a") */
  63:         extzv   $13,$2,r1,r4            /* get MBA number from R1 */
  64:         insv    r4,$24,$8,r10           /* set MBA number */
  65:         insv    r3,$16,$8,r10           /* drive number */
  66: #ifdef PARTITION
  67:         extzv   $12,$4,r5,r4            /* get partition from r5 */
  68:         bicw2   $0xf000,r5              /* remove from r5 */
  69:         insv    r4,$8,$4,r10            /* set partition */
  70: #endif
  71:         movl    r5,r11
  72:         movl    r1,r9                   /* save adaptor address */
  73:         movl    r3,r8                   /* and unit number */
  74:         movl    $RELOC,sp
  75:         moval   init,r6
  76:         movc3   $end,(r6),(sp)
  77:         jmp     *$RELOC+start1
  78: /* running relocated */
  79: start1:
  80:         movl    $MBAinit,M_cr(r9)
  81: /* read-in-preset the drive and set format */
  82:         mull2   $RPDR,r8
  83:         movab   RP(r9)[r8],r8
  84:         movl    $RP_RIP+RP_GO,RP_cr(r8)
  85:         movl    $RP_FMT,RP_off(r8)
  86: 
  87:         .set    PROGSIZE,(BOOTSIZE*RPBPSECT)
  88: start2:
  89:         movl    $0,RP_cyl(r8)
  90:         movl    $1,RP_stk(r8)
  91:         movl    $-PROGSIZE,M_bc(r9)
  92: /* set up MASSBUS map for DMA */
  93:         clrl    r0
  94: 1:
  95:         bisl3   $0x80000000,r0,M_map(r9)[r0]
  96:         aobleq  $BOOTSIZE,r0,1b
  97:         clrl    M_var(r9)
  98:         movl    $RP_RED+RP_GO,RP_cr(r8)
  99: rprdy:
 100:         movl    RP_sr(r8),r0
 101:         bbc     $RP_pDRY,r0,rprdy
 102:         bbs     $RP_pERR,r0,rperr
 103: rprdy2:
 104:         bbs     $pMBABUSY,M_sr(r9),rprdy2
 105: 
 106: /* Eagles are too fast for the controller. Slow the thing down. */
 107: /* (May not be needed with wait for mba above.) */
 108:         clrl    r3
 109: buzz:   acbl    $2000,$1,r3,buzz
 110:         bicpsw  $2
 111:         jbr     clear
 112: rperr:
 113:         halt
 114: /* clear core and execute program */
 115: clear:
 116:         movl    $PROGSIZE,r3
 117: clrcor:
 118:         clrq    (r3)
 119:         acbl    $RELOC,$8,r3,clrcor
 120: /* run loaded program */
 121:         calls   $0,*$0
 122:         brw     start2
 123: 
 124: end:

Defined functions

buzz defined in line 109; used 1 times
clear defined in line 115; used 1 times
clrcor defined in line 117; used 1 times
end defined in line 124; used 1 times
  • in line 76
init defined in line 57; used 1 times
  • in line 75
rperr defined in line 112; used 1 times
rprdy defined in line 99; used 1 times
rprdy2 defined in line 103; used 1 times
start defined in line 61; never used
start1 defined in line 79; used 1 times
  • in line 77
start2 defined in line 88; used 1 times

Defined macros

PARTITION defined in line 10; never used
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 703
Valid CSS Valid XHTML 1.0 Strict