xref: /csrg-svn/sys/vax/mdec/hkboot.c (revision 26885)
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 /* @(#)hkboot.c	6.4 (Berkeley) 03/14/86 */
8 
9 	.set	MAJOR,3		/* major("/dev/hk0a") */
10 
11 /*
12  * RK07 1st level boot program: loads next 7.5Kbytes from
13  * boot sector of file system and sets it up to run.
14  */
15 	.set	RELOC,0x50000
16 	.set	BOOTSIZE,15		/* size of boot in sectors */
17 /* UBA registers */
18 	.set	UBA_CNFGR,0		/* UBA configuration register */
19 	.set	UBA_CR,4		/* UBA control register offset */
20 	.set	UBA_MAP,0x800		/* UBA offset to map reg's */
21 /* RK611 registers and bits */
22 	.set	HK_cs1,0		/* control and status */
23 	.set	HK_wc,2			/* word count */
24 	.set	HK_ba,4			/* bus address */
25 	.set	HK_da,6			/* disk address */
26 	.set	HK_cs2,8		/* control and status */
27 	.set	HK_dc,020		/* desired cylinder */
28 	.set	HKBPSECT,512		/* bytes per sector */
29 	.set	HK_GO,1			/* go bit */
30 	.set	HK_PACK,2		/* pack acknowledge */
31 	.set	HK_RCOM,020		/* read command */
32 	.set	HK_SEL7,02000		/* select RK07 disk */
33 	.set	HK_pRDY,7		/* position of ready bit */
34 	.set	HK_pERR,15		/* position of error bit */
35 
36 init:
37 /* r9	UBA address */
38 /* r8	HK addr */
39 	.word	0  			/* entry mask for dec monitor */
40 	nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
41 	nop;nop;
42 	movl	$MAJOR,r10		/* major("/dev/xx0a") */
43 	extzv	$18,$1,r1,r9		/* get UBA number from R1 */
44 	xorb2	$0x01,r9		/* complement bit */
45 	insv	r9,$24,$8,r10		/* set UBA number */
46 	insv	r3,$16,$8,r10		/* drive number */
47 	extzv	$12,$4,r5,r4		/* get partition from r5 */
48 	bicw2	$0xf000,r5		/* remove from r5 */
49 	insv	r4,$8,$8,r10		/* set partition */
50 	movl	r5,r11			/* boot flags */
51 	movl	physUBA[r9],r9		/* UNIBUS adaptor address */
52 	movl	r2,r8			/* boot device CSR */
53 	movl	r3,r7			/* unit number */
54 
55 /* select unit, init rk611, set vv in drive; if any errors, give up */
56 	movw	r7,HK_cs2(r8)
57 	movw	$HK_SEL7+HK_GO,HK_cs1(r8)
58 1:
59 	movw	HK_cs1(r8),r0
60 	bbc	$HK_pRDY,r0,1b
61 	bbs	$HK_pERR,r0,9f
62 	movw	$HK_SEL7+HK_PACK+HK_GO,HK_cs1(r8)
63 1:
64 	movw	HK_cs1(r8),r0
65 	bbc	$HK_pRDY,r0,1b
66 	bbc	$HK_pERR,r0,start
67 9:
68 	halt
69 /* relocate to high core */
70 start:
71 	movl	r5,r11			/* boot flags */
72 	movl	$RELOC,sp
73 	moval	init,r6
74 	movc3	$end,(r6),(sp)
75 	jmp	*$RELOC+start2
76 /* now running relocated */
77 /* bring in the boot program */
78 	.set	PROGSIZE,(BOOTSIZE*HKBPSECT)
79 start2:
80 	movw	$0,HK_dc(r8)
81 	movw	$1,HK_da(r8)
82 	movw	$-PROGSIZE/2,HK_wc(r8)
83 	clrl	r0
84 1:
85 #	bisl3	$0x80000000,r0,UBA_MAP(r9)
86 #	addl2	$4,r9
87 #	aobleq	$BOOTSIZE,r0,1b
88 	clrw	HK_ba(r8)
89 	movw	$HK_SEL7+HK_RCOM+HK_GO,HK_cs1(r8)
90 hkrdy:
91 	movw	HK_cs1(r8),r0
92 	bbc	$HK_pRDY,r0,hkrdy
93 	bbs	$HK_pERR,r0,hkerr
94 	brw	done
95 hkerr:
96 	halt			/* ungraceful */
97 done:
98 	movl	$PROGSIZE,r3
99 clrcor:
100 	clrq	(r3)
101 	acbl	$RELOC,$8,r3,clrcor
102 /* start loaded program */
103 	calls	$0,*$0
104 	brw	start2
105 physUBA:
106 	.long	0xf30000		/* uba0 */
107 	.long	0xf32000		/* uba1 */
108 end:
109