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