Commit | Line | Data |
---|---|---|
cb1c44c2 KM |
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 | #ifndef lint | |
8 | _sccsid:.asciz "@(#)upboot.c 6.2 (Berkeley) %G%" | |
9 | #endif not lint | |
c8cf0b57 SL |
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 | .set SID,62 /* system ID register */ | |
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 | .set UBAinit,1 /* UBA init bit in UBA control reg */ | |
25 | .set pUBIC,16 /* Unibus init complete */ | |
26 | /* UP registers and bits */ | |
27 | .set UP,0176700-0160000 /* address of UP controller */ | |
28 | .set UP_cs1,UP+0 /* control and status */ | |
29 | .set UP_wc,UP+2 /* word count */ | |
30 | .set UP_ba,UP+4 /* bus address */ | |
31 | .set UP_da,UP+6 /* disk address */ | |
32 | .set UP_cs2,UP+010 /* cs2 register */ | |
33 | .set UP_of,UP+032 /* offset register */ | |
34 | .set UP_dc,UP+034 /* desired cylinder */ | |
35 | .set UP_hr,UP+036 /* holding register */ | |
36 | .set UP_GO,1 /* go bit */ | |
37 | .set UP_PACK,022 /* pack acknowledge */ | |
38 | .set UP_DCLR,010 /* drive clear */ | |
39 | .set UP_PRESET,020 /* read-in-preset */ | |
40 | .set UP_RCOM,070 /* read command */ | |
41 | .set UPCS2_CLR,040 | |
42 | .set UP_pRDY,7 /* position of ready bit */ | |
43 | .set UP_pERR,15 /* position of error bit */ | |
44 | .set UP_FMT22,010000 | |
45 | ||
46 | init: | |
47 | .word 0 /* entry mask for dec monitor */ | |
48 | nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */ | |
49 | nop;nop; | |
50 | /* get cpu type and find the first uba */ | |
51 | mfpr $SID,r0 | |
52 | extzv $24,$8,r0,r0 /* get cpu type */ | |
53 | ashl $2,r0,r1 | |
54 | movab physUBA,r2 /* get physUBA[cpu] */ | |
55 | addl2 r1,r2 | |
56 | movl (r2),r9 | |
57 | movab physUMEM,r2 /* get physUMEM[cpu] */ | |
58 | addl2 r1,r2 | |
59 | movl (r2),r10 | |
60 | /* if 780, init uba */ | |
61 | cmpl r0,$1 | |
62 | bneq 2f | |
63 | movl $UBAinit,UBA_CR(r9) | |
64 | 1: | |
65 | bbc $pUBIC,UBA_CNFGR(r9),1b | |
66 | 2: | |
67 | movl $5000000,r0 | |
68 | 1: | |
69 | sobgtr r0,1b | |
70 | /* init up, set vv in drive 0; if any errors, give up */ | |
71 | movw $UPCS2_CLR,UP_cs2(r10) | |
72 | movw $UP_DCLR+UP_GO,UP_cs1(r10) | |
73 | movw $UP_PRESET+UP_GO,UP_cs1(r10) | |
74 | movw $UP_FMT22,UP_of(r10) | |
75 | 1: | |
76 | movw UP_cs1(r10),r0 | |
77 | bbc $UP_pRDY,r0,1b | |
78 | /* relocate to high core */ | |
79 | start: | |
80 | movl r5,r11 /* boot flags */ | |
81 | movl $RELOC,sp | |
82 | moval init,r6 | |
83 | movc3 $end,(r6),(sp) | |
84 | jmp *$RELOC+start2 | |
85 | /* now running relocated */ | |
86 | .set PROGSIZE,(BOOTSIZE*UPBPSECT) | |
87 | start2: | |
88 | movw $0,UP_dc(r10) | |
89 | movw $1,UP_da(r10) | |
90 | movw $-PROGSIZE/2,UP_wc(r10) | |
91 | clrl r0 | |
92 | 1: | |
93 | bisl3 $0x80000000,r0,UBA_MAP(r9) | |
94 | addl2 $4,r9 | |
95 | aobleq $BOOTSIZE,r0,1b | |
96 | clrw UP_ba(r10) | |
97 | movw $UP_RCOM+UP_GO,UP_cs1(r10) | |
98 | uprdy: | |
99 | movw UP_cs1(r10),r0 | |
100 | bbc $UP_pRDY,r0,uprdy | |
101 | clear: | |
102 | movl $PROGSIZE,r3 | |
103 | clrcor: | |
104 | clrq (r3) | |
105 | acbl $RELOC,$8,r3,clrcor | |
106 | /* run loaded program */ | |
107 | movl $2,r10 /* major("/dev/up0a") */ | |
108 | calls $0,*$0 | |
109 | brw start2 | |
110 | physUBA: | |
111 | .long 0 | |
112 | .long 0x20006000 /* 11/780 */ | |
113 | .long 0xf30000 /* 11/750 */ | |
114 | .long 0xf26000 /* 11/730 */ | |
115 | physUMEM: | |
116 | .long 0 | |
117 | .long 0x2013e000 /* 11/780 */ | |
118 | .long 0xffe000 /* 11/750 */ | |
119 | .long 0xffe000 /* 11/730 */ | |
120 | end: |