Commit | Line | Data |
---|---|---|
cb1c44c2 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1980, 1986 Regents of the University of California. |
cb1c44c2 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
e86f39b7 | 7 | /* "@(#)upboot.c 7.3 (Berkeley) %G%" */ |
70385c9b | 8 | #include <sys/disklabel.h> |
a96c16a1 MK |
9 | |
10 | .set MAJOR,2 /* major("/dev/up0a") */ | |
c8cf0b57 SL |
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 */ | |
c8cf0b57 SL |
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 */ | |
c8cf0b57 | 24 | /* UP registers and bits */ |
a96c16a1 MK |
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 */ | |
c8cf0b57 SL |
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: | |
a96c16a1 MK |
44 | /* r9 UBA address */ |
45 | /* r8 UP addr */ | |
c8cf0b57 SL |
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; | |
a96c16a1 MK |
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 */ | |
70385c9b | 58 | |
e86f39b7 | 59 | movl r2,r8 /* boot device CSR */ |
70385c9b MK |
60 | brw start0 |
61 | ||
62 | /* | |
63 | * Leave space for pack label. | |
64 | */ | |
65 | pad: | |
66 | .space LABELOFFSET - (pad - init) | |
67 | packlabel: | |
68 | .space d_end_ | |
69 | ||
70 | start0: | |
a96c16a1 | 71 | movl physUBA[r9],r9 /* UNIBUS adaptor address */ |
a96c16a1 | 72 | movl r3,r7 /* unit number */ |
a96c16a1 MK |
73 | movl $RELOC,sp |
74 | moval init,r4 | |
75 | movc3 $end,(r4),(sp) | |
a96c16a1 | 76 | /* init up, set vv in drive; if any errors, give up */ |
e86f39b7 | 77 | /* probably unneeded: rom should have already done this */ |
a96c16a1 MK |
78 | bisw3 r7,$UPCS2_CLR,UP_cs2(r8) |
79 | movw $UP_DCLR+UP_GO,UP_cs1(r8) | |
80 | movw $UP_PRESET+UP_GO,UP_cs1(r8) | |
81 | movw $UP_FMT22,UP_of(r8) | |
c8cf0b57 | 82 | 1: |
a96c16a1 | 83 | movw UP_cs1(r8),r0 |
c8cf0b57 SL |
84 | bbc $UP_pRDY,r0,1b |
85 | /* relocate to high core */ | |
86 | start: | |
c8cf0b57 SL |
87 | movl $RELOC,sp |
88 | moval init,r6 | |
89 | movc3 $end,(r6),(sp) | |
90 | jmp *$RELOC+start2 | |
91 | /* now running relocated */ | |
92 | .set PROGSIZE,(BOOTSIZE*UPBPSECT) | |
93 | start2: | |
a96c16a1 MK |
94 | movw $0,UP_dc(r8) |
95 | movw $1,UP_da(r8) | |
96 | movw $-PROGSIZE/2,UP_wc(r8) | |
c8cf0b57 SL |
97 | clrl r0 |
98 | 1: | |
99 | bisl3 $0x80000000,r0,UBA_MAP(r9) | |
100 | addl2 $4,r9 | |
101 | aobleq $BOOTSIZE,r0,1b | |
a96c16a1 MK |
102 | clrw UP_ba(r8) |
103 | movw $UP_RCOM+UP_GO,UP_cs1(r8) | |
c8cf0b57 | 104 | uprdy: |
a96c16a1 | 105 | movw UP_cs1(r8),r0 |
c8cf0b57 SL |
106 | bbc $UP_pRDY,r0,uprdy |
107 | clear: | |
108 | movl $PROGSIZE,r3 | |
109 | clrcor: | |
110 | clrq (r3) | |
111 | acbl $RELOC,$8,r3,clrcor | |
112 | /* run loaded program */ | |
c8cf0b57 SL |
113 | calls $0,*$0 |
114 | brw start2 | |
115 | physUBA: | |
a96c16a1 MK |
116 | .long 0xf30000 /* uba0 */ |
117 | .long 0xf32000 /* uba1 */ | |
c8cf0b57 | 118 | end: |