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 /* "@(#)upboot.c 6.3 (Berkeley) 06/26/85" */ 8 9 /* 10 * UP 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 */ 14 .set BOOTSIZE,15 /* size of boot in sectors */ 15 .set RELOC,0x50000 16 .set UPBPSECT,512 /* bytes per sector */ 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 /* UP registers and bits */ 25 .set UP,0176700-0160000 /* address of UP controller */ 26 .set UP_cs1,UP+0 /* control and status */ 27 .set UP_wc,UP+2 /* word count */ 28 .set UP_ba,UP+4 /* bus address */ 29 .set UP_da,UP+6 /* disk address */ 30 .set UP_cs2,UP+010 /* cs2 register */ 31 .set UP_of,UP+032 /* offset register */ 32 .set UP_dc,UP+034 /* desired cylinder */ 33 .set UP_hr,UP+036 /* holding register */ 34 .set UP_GO,1 /* go bit */ 35 .set UP_PACK,022 /* pack acknowledge */ 36 .set UP_DCLR,010 /* drive clear */ 37 .set UP_PRESET,020 /* read-in-preset */ 38 .set UP_RCOM,070 /* read command */ 39 .set UPCS2_CLR,040 40 .set UP_pRDY,7 /* position of ready bit */ 41 .set UP_pERR,15 /* position of error bit */ 42 .set UP_FMT22,010000 43 44 init: 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 /* get cpu type and find the first uba */ 49 mfpr $SID,r0 50 extzv $24,$8,r0,r0 /* get cpu type */ 51 ashl $2,r0,r1 52 movab physUBA,r2 /* get physUBA[cpu] */ 53 addl2 r1,r2 54 movl (r2),r9 55 movab physUMEM,r2 /* get physUMEM[cpu] */ 56 addl2 r1,r2 57 movl (r2),r10 58 /* if 780, init uba */ 59 cmpl r0,$1 60 bneq 2f 61 movl $UBAinit,UBA_CR(r9) 62 1: 63 bbc $pUBIC,UBA_CNFGR(r9),1b 64 2: 65 movl $5000000,r0 66 1: 67 sobgtr r0,1b 68 /* init up, set vv in drive 0; if any errors, give up */ 69 movw $UPCS2_CLR,UP_cs2(r10) 70 movw $UP_DCLR+UP_GO,UP_cs1(r10) 71 movw $UP_PRESET+UP_GO,UP_cs1(r10) 72 movw $UP_FMT22,UP_of(r10) 73 1: 74 movw UP_cs1(r10),r0 75 bbc $UP_pRDY,r0,1b 76 /* relocate to high core */ 77 start: 78 movl r5,r11 /* boot flags */ 79 movl $RELOC,sp 80 moval init,r6 81 movc3 $end,(r6),(sp) 82 jmp *$RELOC+start2 83 /* now running relocated */ 84 .set PROGSIZE,(BOOTSIZE*UPBPSECT) 85 start2: 86 movw $0,UP_dc(r10) 87 movw $1,UP_da(r10) 88 movw $-PROGSIZE/2,UP_wc(r10) 89 clrl r0 90 1: 91 bisl3 $0x80000000,r0,UBA_MAP(r9) 92 addl2 $4,r9 93 aobleq $BOOTSIZE,r0,1b 94 clrw UP_ba(r10) 95 movw $UP_RCOM+UP_GO,UP_cs1(r10) 96 uprdy: 97 movw UP_cs1(r10),r0 98 bbc $UP_pRDY,r0,uprdy 99 clear: 100 movl $PROGSIZE,r3 101 clrcor: 102 clrq (r3) 103 acbl $RELOC,$8,r3,clrcor 104 /* run loaded program */ 105 movl $2,r10 /* major("/dev/up0a") */ 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