1 /* 2 * Copyright (c) 1980 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 /* "@(#)rlboot.c 6.3 (Berkeley) 06/26/85" */ 8 9 /* 10 * RL02 1st level boot program: loads next 7.5Kbytes from 11 * boot sector of file system and sets it up to run. 12 * Always reads from drive 0. 13 * UNTESTED 14 */ 15 .set BOOTSIZE,15 /* 15 ``sectors'' */ 16 .set RELOC,0x50000 17 .set SID,62 /* system ID register */ 18 /* UBA registers */ 19 .set UBA_CNFGR,0 /* UBA configuration register */ 20 .set UBA_CR,4 /* UBA control register offset */ 21 .set UBA_MAP,0x800 /* UBA offset to map reg's */ 22 .set UBAinit,1 /* UBA init bit in UBA control reg */ 23 .set pUBIC,16 /* Unibus init complete */ 24 /* RL11 registers and bits */ 25 .set HL,0174400-0160000 /* address of RL11 */ 26 .set HLBPSECT,512 /* sector size in bytes (kludge) */ 27 .set HL_cs,HL+0 /* control and status */ 28 .set HL_ba,HL+2 /* bus address */ 29 .set HL_da,HL+4 /* disk address */ 30 .set HL_wc,HL+6 /* word count */ 31 .set HL_GO,0 /* go bit */ 32 .set HL_RCOM,014 /* read command */ 33 .set HL_SEEK,06 /* seek */ 34 .set HL_RESET,013 /* reset drive */ 35 .set HL_GSTAT,04 /* get status command */ 36 .set HL_pRDY,7 /* position of ready bit */ 37 .set HL_pERR,15 /* position of error bit */ 38 39 init: 40 /* r9 UBA address */ 41 /* r10 umem addr */ 42 .word 0 /* entry mask for dec monitor */ 43 nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */ 44 nop;nop; 45 /* get cpu type and find the first uba */ 46 mfpr $SID,r0 47 extzv $24,$8,r0,r0 /* get cpu type */ 48 ashl $2,r0,r1 49 movab physUBA,r2 /* get physUBA[cpu] */ 50 addl2 r1,r2 51 movl (r2),r9 52 movab physUMEM,r2 /* get physUMEM[cpu] */ 53 addl2 r1,r2 54 movl (r2),r10 55 /* if 780, init uba */ 56 cmpl r0,$1 57 bneq 2f 58 movl $UBAinit,UBA_CR(r9) 59 1: 60 bbc $pUBIC,UBA_CNFGR(r9),1b 61 2: 62 /* init rl11, and drive 0, don't check for any errors now */ 63 movw $HL_RESET,HL_da(r10) 64 movw $HL_GSTAT+HL_GO,HL_cs(r10) 65 /* relocate to high core */ 66 start: 67 movl r5,r11 /* save boot flags */ 68 movl $RELOC,sp 69 moval init,r6 70 movc3 $end,(r6),(sp) 71 jmp *$RELOC+start2 72 /* now running relocated */ 73 /* read in the boot program */ 74 .set PROGSIZE,(BOOTSIZE*HLBPSECT) 75 start2: 76 movw $1,HL_da(r10) /* seek to cylinder 0 */ 77 movw $HL_SEEK+HL_GO,HL_cs(r10) 78 1: 79 movw HL_cs(r10),r0 80 bbc $HL_pRDY,r0,1b 81 bbs $HL_pERR,r0,hlerr 82 /* Rl has 256 byte sectors */ 83 movw $2,HL_da(r10) /* read program */ 84 movw $-PROGSIZE/2,HL_wc(r10) 85 clrl r0 86 1: 87 bisl3 $0x80000000,r0,UBA_MAP(r9) 88 addl2 $4,r9 89 aobleq $BOOTSIZE,r0,1b 90 clrw HL_ba(r10) 91 movw $HL_RCOM+HL_GO,HL_cs(r10) 92 1: 93 movw HL_cs(r10),r0 94 bbc $HL_pRDY,r0,1b 95 bbs $HL_pERR,r0,hlerr 96 brw done 97 hlerr: 98 halt /* ungraceful */ 99 done: 100 movl $PROGSIZE,r3 101 clrcor: 102 clrq (r3) 103 acbl $RELOC,$8,r3,clrcor 104 /* run loaded program */ 105 movl $14,r10 /* major("/dev/hl0a") */ 106 calls $0,*$0 107 brw start2 108 physUBA: 109 .long 0 110 .long 0x20006000 /* 11/780 */ 111 .long 0xf30000 /* 11/750 */ 112 .long 0xf26000 /* 11/730 */ 113 physUMEM: 114 .long 0 115 .long 0x2013e000 /* 11/780 */ 116 .long 0xffe000 /* 11/750 */ 117 .long 0xffe000 /* 11/730 */ 118 end: 119