1/*
2 * Copyright (c) 2003-2004 The Regents of The University of Michigan
3 * Copyright (c) 1993 The Hewlett-Packard Development Company
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include "dc21164FromGasSources.h"	// DECchip 21164 specific definitions
31#include "ev5_defs.h"
32#include "fromHudsonOsf.h"		// OSF/1 specific definitions
33#include "fromHudsonMacros.h"		// Global macro definitions
34
35/*
36 * args:
37 *   a0: here
38 *   a1: boot location
39 *   a2: CSERVE_J_KTOPAL
40 *   a3: restrart_pv
41 *   a4: vptb
42 *   a5: my_rpb
43 *
44 * SRM Console Architecture III 3-26
45 */
46
47        .global	palJToSlave
48        .text	3
49palJToSlave:
50
51        ALIGN_BRANCH
52
53        bis	a3, zero, pv
54        bis	zero, zero, t11
55        bis	zero, zero, ra
56
57        /* Point the Vptbr to a2 */
58
59        mtpr	a4, mVptBr	// Load Mbox copy
60        mtpr	a4, iVptBr	// Load Ibox copy
61        STALL			// don't dual issue the load with mtpr -pb
62
63        /* Turn on superpage mapping in the mbox and icsr */
64        lda	t0, (2<<MCSR_V_SP)(zero) // Get a '10' (binary) in MCSR<SP>
65        STALL			// don't dual issue the load with mtpr -pb
66        mtpr	t0, mcsr	// Set the super page mode enable bit
67        STALL			// don't dual issue the load with mtpr -pb
68
69        lda	t0, 0(zero)
70        mtpr	t0, dtbAsn
71        mtpr	t0, itbAsn
72
73        LDLI	(t1,0x20000000)
74        STALL			// don't dual issue the load with mtpr -pb
75        mfpr	t0, icsr	// Enable superpage mapping
76        STALL			// don't dual issue the load with mtpr -pb
77        bis	t0, t1, t0
78        mtpr	t0, icsr
79
80        STALL			// Required stall to update chip ...
81        STALL
82        STALL
83        STALL
84        STALL
85
86        ldq_p	s0, PCB_Q_PTBR(a5)
87        sll	s0, VA_S_OFF, s0 // Shift PTBR into position
88        STALL			// don't dual issue the load with mtpr -pb
89        mtpr	s0, ptPtbr	// PHYSICAL MBOX INST -> MT PT20 IN 0,1
90        STALL			// don't dual issue the load with mtpr -pb
91        ldq_p	sp, PCB_Q_KSP(a5)
92
93        mtpr	zero, dtbIa	// Flush all D-stream TB entries
94        mtpr	zero, itbIa	// Flush all I-stream TB entries
95
96        mtpr	a1, excAddr	// Load the dispatch address.
97
98        STALL			// don't dual issue the load with mtpr -pb
99        STALL			// don't dual issue the load with mtpr -pb
100        mtpr	zero, dtbIa	// Flush all D-stream TB entries
101        mtpr	zero, itbIa	// Flush all I-stream TB entries
102        br	zero, 2f
103
104        ALIGN_BLOCK
105
1062:	NOP
107        mtpr	zero, icFlush	// Flush the icache.
108        NOP
109        NOP
110
111        NOP			// Required NOPs ... 1-10
112        NOP
113        NOP
114        NOP
115        NOP
116        NOP
117        NOP
118        NOP
119        NOP
120        NOP
121
122        NOP			// Required NOPs ... 11-20
123        NOP
124        NOP
125        NOP
126        NOP
127        NOP
128        NOP
129        NOP
130        NOP
131        NOP
132
133        NOP			// Required NOPs ... 21-30
134        NOP
135        NOP
136        NOP
137        NOP
138        NOP
139        NOP
140        NOP
141        NOP
142        NOP
143
144        NOP			// Required NOPs ... 31-40
145        NOP
146        NOP
147        NOP
148        NOP
149        NOP
150        NOP
151        NOP
152        NOP
153        NOP
154
155        NOP			// Required NOPs ... 41-44
156        NOP
157        NOP
158        NOP
159
160        hw_rei_stall		// Dispatch to kernel
161
162