Annotation of 43BSDReno/sys/mdec/hpboot.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.