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: /* "@(#)upboot.s 7.1 (Berkeley) 6/5/86" */ 8: 9: .set MAJOR,2 /* major("/dev/up0a") */ 10: 11: /* 12: * UP 1st level boot program: loads next 7.5Kbytes from 13: * boot sector of file system and sets it up to run. 14: * Always reads from drive 0. 15: */ 16: .set BOOTSIZE,15 /* size of boot in sectors */ 17: .set RELOC,0x50000 18: .set UPBPSECT,512 /* bytes per sector */ 19: /* UBA registers */ 20: .set UBA_CNFGR,0 /* UBA configuration register */ 21: .set UBA_CR,4 /* UBA control register offset */ 22: .set UBA_MAP,0x800 /* UBA offset to map reg's */ 23: /* UP registers and bits */ 24: .set UP_cs1,0 /* control and status */ 25: .set UP_wc,2 /* word count */ 26: .set UP_ba,4 /* bus address */ 27: .set UP_da,6 /* disk address */ 28: .set UP_cs2,010 /* cs2 register */ 29: .set UP_of,032 /* offset register */ 30: .set UP_dc,034 /* desired cylinder */ 31: .set UP_hr,036 /* holding register */ 32: .set UP_GO,1 /* go bit */ 33: .set UP_PACK,022 /* pack acknowledge */ 34: .set UP_DCLR,010 /* drive clear */ 35: .set UP_PRESET,020 /* read-in-preset */ 36: .set UP_RCOM,070 /* read command */ 37: .set UPCS2_CLR,040 38: .set UP_pRDY,7 /* position of ready bit */ 39: .set UP_pERR,15 /* position of error bit */ 40: .set UP_FMT22,010000 41: 42: init: 43: /* r9 UBA address */ 44: /* r8 UP addr */ 45: .word 0 /* entry mask for dec monitor */ 46: nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */ 47: nop;nop; 48: movl $MAJOR,r10 /* major("/dev/xx0a") */ 49: extzv $18,$1,r1,r9 /* get UBA number from R1 */ 50: xorb2 $0x01,r9 /* complement bit */ 51: insv r9,$24,$8,r10 /* set UBA number */ 52: insv r3,$16,$8,r10 /* drive number */ 53: extzv $12,$4,r5,r4 /* get partition from r5 */ 54: bicw2 $0xf000,r5 /* remove from r5 */ 55: insv r4,$8,$8,r10 /* set partition */ 56: movl r5,r11 /* boot flags */ 57: movl physUBA[r9],r9 /* UNIBUS adaptor address */ 58: movl r2,r8 /* boot device CSR */ 59: movl r3,r7 /* unit number */ 60: 61: movl $RELOC,sp 62: moval init,r4 63: movc3 $end,(r4),(sp) 64: movl r9,r1 /* UNIBUS I/O page address */ 65: movl r8,r2 /* boot device CSR */ 66: movl r7,r3 /* unit number */ 67: /* init up, set vv in drive; if any errors, give up */ 68: bisw3 r7,$UPCS2_CLR,UP_cs2(r8) 69: movw $UP_DCLR+UP_GO,UP_cs1(r8) 70: movw $UP_PRESET+UP_GO,UP_cs1(r8) 71: movw $UP_FMT22,UP_of(r8) 72: 1: 73: movw UP_cs1(r8),r0 74: bbc $UP_pRDY,r0,1b 75: /* relocate to high core */ 76: start: 77: movl r5,r11 /* boot flags */ 78: movl $RELOC,sp 79: moval init,r6 80: movc3 $end,(r6),(sp) 81: jmp *$RELOC+start2 82: /* now running relocated */ 83: .set PROGSIZE,(BOOTSIZE*UPBPSECT) 84: start2: 85: movw $0,UP_dc(r8) 86: movw $1,UP_da(r8) 87: movw $-PROGSIZE/2,UP_wc(r8) 88: clrl r0 89: 1: 90: bisl3 $0x80000000,r0,UBA_MAP(r9) 91: addl2 $4,r9 92: aobleq $BOOTSIZE,r0,1b 93: clrw UP_ba(r8) 94: movw $UP_RCOM+UP_GO,UP_cs1(r8) 95: uprdy: 96: movw UP_cs1(r8),r0 97: bbc $UP_pRDY,r0,uprdy 98: clear: 99: movl $PROGSIZE,r3 100: clrcor: 101: clrq (r3) 102: acbl $RELOC,$8,r3,clrcor 103: /* run loaded program */ 104: calls $0,*$0 105: brw start2 106: physUBA: 107: .long 0xf30000 /* uba0 */ 108: .long 0xf32000 /* uba1 */ 109: end: