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: /* "@(#)rlboot.s 7.1 (Berkeley) 6/5/86" */ 8: 9: .set MAJOR,14 /* major("/dev/rl0a") */ 10: 11: /* 12: * RL02 1st level boot program: loads next 7.5Kbytes from 13: * boot sector of file system and sets it up to run. 14: */ 15: .set BOOTSIZE,15 /* 15 ``sectors'' */ 16: .set RELOC,0x50000 17: /* UBA registers */ 18: .set UBA_CNFGR,0 /* UBA configuration register */ 19: .set UBA_CR,4 /* UBA control register offset */ 20: .set UBA_MAP,0x800 /* UBA offset to map reg's */ 21: /* RL11 registers and bits */ 22: .set HL,0174400-0160000 /* address of RL11 */ 23: .set HLBPSECT,512 /* sector size in bytes (kludge) */ 24: .set HL_cs,HL+0 /* control and status */ 25: .set HL_ba,HL+2 /* bus address */ 26: .set HL_da,HL+4 /* disk address */ 27: .set HL_wc,HL+6 /* word count */ 28: .set HL_RDY,0200 /* READY */ 29: .set HL_RCOM,014 /* read command */ 30: .set HL_SEEK,06 /* seek */ 31: .set HL_RESET,013 /* reset drive */ 32: .set HL_GSTAT,04 /* get status command */ 33: .set HL_pRDY,7 /* position of ready bit */ 34: .set HL_pERR,15 /* position of error bit */ 35: 36: init: 37: /* r9 UBA address */ 38: /* r8 RL addr */ 39: .word 0 /* entry mask for dec monitor */ 40: nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */ 41: nop;nop; 42: movl $MAJOR,r10 /* major("/dev/xx0a") */ 43: extzv $18,$1,r1,r9 /* get UBA number from R1 */ 44: xorb2 $0x01,r9 /* complement bit */ 45: insv r9,$24,$8,r10 /* set UBA number */ 46: insv r3,$16,$8,r10 /* drive number */ 47: extzv $12,$4,r5,r4 /* get partition from r5 */ 48: bicw2 $0xf000,r5 /* remove from r5 */ 49: insv r4,$8,$8,r10 /* set partition */ 50: movl r5,r11 /* boot flags */ 51: movl physUBA[r9],r9 /* UNIBUS adaptor address */ 52: movl r2,r8 /* boot device CSR */ 53: movl r3,r7 /* unit number */ 54: ashl $8,r7,r7 /* shifted for HL_cs */ 55: 56: /* init rl11, and drive, don't check for any errors now */ 57: movw $HL_RESET,HL_da(r8) 58: bisw3 r7,$HL_GSTAT,HL_cs(r8) 59: /* relocate to high core */ 60: start: 61: movl r5,r11 /* save boot flags */ 62: movl $RELOC,sp 63: moval init,r6 64: movc3 $end,(r6),(sp) 65: jmp *$RELOC+start2 66: /* now running relocated */ 67: /* read in the boot program */ 68: .set PROGSIZE,(BOOTSIZE*HLBPSECT) 69: start2: 70: movw $1,HL_da(r8) /* seek to cylinder 0 */ 71: bisw3 r7,$HL_SEEK,HL_cs(r8) 72: 1: 73: movw HL_cs(r8),r0 74: bbc $HL_pRDY,r0,1b 75: bbs $HL_pERR,r0,hlerr 76: /* Rl has 256 byte sectors */ 77: movw $2,HL_da(r8) /* read program */ 78: movw $-PROGSIZE/2,HL_wc(r8) 79: clrl r0 80: 1: 81: bisl3 $0x80000000,r0,UBA_MAP(r9) 82: addl2 $4,r9 83: aobleq $BOOTSIZE,r0,1b 84: clrw HL_ba(r8) 85: bisw3 r7,$HL_RCOM,HL_cs(r8) 86: 1: 87: movw HL_cs(r8),r0 88: bbc $HL_pRDY,r0,1b 89: bbc $HL_pERR,r0,done 90: hlerr: 91: halt /* ungraceful */ 92: done: 93: movl $PROGSIZE,r3 94: clrcor: 95: clrq (r3) 96: acbl $RELOC,$8,r3,clrcor 97: /* run loaded program */ 98: calls $0,*$0 99: brw start2 100: physUBA: 101: .long 0xf30000 /* uba0 */ 102: .long 0xf32000 /* uba1 */ 103: end: