|
|
1.1 root 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: /* "@(#)rlboot.c 7.3 (Berkeley) 2/21/87" */
8: #include <sys/disklabel.h>
9:
10: .set MAJOR,14 /* major("/dev/rl0a") */
11:
12: /*
13: * RL02 1st level boot program: loads next 7.5Kbytes from
14: * boot sector of file system and sets it up to run.
15: */
16: .set BOOTSIZE,15 /* 15 ``sectors'' */
17: .set RELOC,0x50000
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: /* RL11 registers and bits */
23: .set HL,0174400-0160000 /* address of RL11 */
24: .set HLBPSECT,512 /* sector size in bytes (kludge) */
25: .set HL_cs,HL+0 /* control and status */
26: .set HL_ba,HL+2 /* bus address */
27: .set HL_da,HL+4 /* disk address */
28: .set HL_wc,HL+6 /* word count */
29: .set HL_RDY,0200 /* READY */
30: .set HL_RCOM,014 /* read command */
31: .set HL_SEEK,06 /* seek */
32: .set HL_RESET,013 /* reset drive */
33: .set HL_GSTAT,04 /* get status command */
34: .set HL_pRDY,7 /* position of ready bit */
35: .set HL_pERR,15 /* position of error bit */
36:
37: init:
38: /* r9 UBA address */
39: /* r8 RL addr */
40: .word 0 /* entry mask for dec monitor */
41: nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
42: nop;nop;
43: cvtbl $MAJOR,r10 /* major("/dev/xx0a") */
44: extzv $18,$1,r1,r9 /* get UBA number from R1 */
45: xorb2 $0x01,r9 /* complement bit */
46: insv r9,$24,$8,r10 /* set UBA number */
47: insv r3,$16,$8,r10 /* drive number */
48: extzv $12,$4,r5,r4 /* get partition from r5 */
49: bicw2 $0xf000,r5 /* remove from r5 */
50: insv r4,$8,$8,r10 /* set partition */
51: movl r5,r11 /* boot flags */
52:
53: movl r2,r8 /* boot device CSR */
54: brw start0
55:
56: /*
57: * Leave space for pack label.
58: */
59: pad:
60: .space LABELOFFSET - (pad - init)
61: packlabel:
62: .space d_end_
63:
64: start0:
65: movl physUBA[r9],r9 /* UNIBUS adaptor address */
66: ashl $8,r3,r7 /* unit number, shifted for HL_cs */
67:
68: /* init rl11, and drive, don't check for any errors now */
69: movw $HL_RESET,HL_da(r8)
70: bisw3 r7,$HL_GSTAT,HL_cs(r8)
71: /* relocate to high core */
72: start:
73: movl $RELOC,sp
74: moval init,r6
75: movc3 $end,(r6),(sp)
76: jmp *$RELOC+start2
77: /* now running relocated */
78: /* read in the boot program */
79: .set PROGSIZE,(BOOTSIZE*HLBPSECT)
80: start2:
81: movw $1,HL_da(r8) /* seek to cylinder 0 */
82: bisw3 r7,$HL_SEEK,HL_cs(r8)
83: 1:
84: movw HL_cs(r8),r0
85: bbc $HL_pRDY,r0,1b
86: bbs $HL_pERR,r0,hlerr
87: /* Rl has 256 byte sectors */
88: movw $2,HL_da(r8) /* read program */
89: movw $-PROGSIZE/2,HL_wc(r8)
90: clrl r0
91: 1:
92: bisl3 $0x80000000,r0,UBA_MAP(r9)
93: addl2 $4,r9
94: aobleq $BOOTSIZE,r0,1b
95: clrw HL_ba(r8)
96: bisw3 r7,$HL_RCOM,HL_cs(r8)
97: 1:
98: movw HL_cs(r8),r0
99: bbc $HL_pRDY,r0,1b
100: bbc $HL_pERR,r0,done
101: hlerr:
102: halt /* ungraceful */
103: done:
104: movl $PROGSIZE,r3
105: clrcor:
106: clrq (r3)
107: acbl $RELOC,$8,r3,clrcor
108: /* run loaded program */
109: calls $0,*$0
110: brw start2
111: physUBA:
112: .long 0xf30000 /* uba0 */
113: .long 0xf32000 /* uba1 */
114: end:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.