summaryrefslogtreecommitdiffstats
path: root/private/ntos/fw/alpha/jnupass.s
blob: c40691e06ae8ce6a2fbc2c4362c229bbd0b9cf2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*++

Copyright (c) 1993  Digital Equipment Corporation


Module Name:

    jnupass.s


Abstract:

    This contains assembler code routines for the Alpha
    firmware update programs (e.g., JNUPDATE.EXE).


Author:

    John DeRosa  [DEC]	21-May-1992


Environment:

    Executes in kernel mode.

Revision History:

    Bruce Butts  [DEC]  04-June-1993

    Added functions to read and write Morgan control space registers.


--*/

#include "ksalpha.h"
#include "machdef.h"

/*****************************************************************

Simple functions to perform memory barriers.  These are needed because
our current compiler does not do asm's.

******************************************************************/


	 LEAF_ENTRY(AlphaInstIMB)

	callpal	imb
	ret	zero, (ra)

	.end    AlphaInstIMB



	 LEAF_ENTRY(AlphaInstMB)

	mb
	ret	zero, (ra)

	.end    AlphaInstMB



	 LEAF_ENTRY(AlphaInstHalt)

	callpal	halt
	ret	zero, (ra)		# should never return, but...

	.end    AlphaInstHalt


#ifdef MORGAN

/*****************************************************************

Functions to read and write Morgan Harley chip set control
registers. This routines are very similar to the HAL functions
READ_REGISTER_ULONG and WRITE_REGISTER_ULONG; the difference is
that bits <4:0> of the physical address of the control register
*must be zero*, instead of a 0x18 as in the HAL functions.
Addresses supplied are normal QVA of the desired control register.

******************************************************************/


	 LEAF_ENTRY(READ_CONTROL_REGISTER_ULONG)

/*++

Routine Description:

	Reads a longword location from Morgan control register space.


Arguments:

	a0	QVA of longword to be read.


Return Value:

	v0	Register data.

--*/
	
	and	a0, QVA_SELECTORS, t1	# get qva selector bits
	xor	t1, QVA_ENABLE, t1	# ok iff QVA_ENABLE set in selectors
	bne	t1, 2f			# if ne, iff failed

	zap	a0, 0xf0, a0		# clear <63:32>
        bic     a0, QVA_ENABLE,a0       # clear QVA fields so shift is correct
	sll	a0, IO_BIT_SHIFT, t0
	ldiq	t4, -0x4000
	sll	t4, 28, t4
	or	t0, t4, t0		# superpage mode

//      or      t0, IO_LONG_LEN, t0	# or in the byte enables

	ldl	v0, (t0)		# read the longword
	ret	zero, (ra)
	
2:
//
// On non-I/O space access, do a normal memory operation
//
        ldl     v0, (a0)		# read the longword
	ret	zero, (ra)


    .end    READ_CONTROL_REGISTER_ULONG



	 LEAF_ENTRY(WRITE_CONTROL_REGISTER_ULONG)

/*++

Routine Description:

	Writes a longword location to I/O space.


Arguments:

	a0	QVA of longword to be read.
        a1      Longword to be written.


Return Value:

	None.


--*/
	
	and	a0, QVA_SELECTORS, t1	# get qva selector bits
	xor	t1, QVA_ENABLE, t1	# ok iff QVA_ENABLE set in selectors
	bne	t1, 2f			# if ne, iff failed

	zap	a0, 0xf0, a0		# clear <63:32>
        bic     a0, QVA_ENABLE,a0       # clear QVA fields so shift is correct
	sll	a0, IO_BIT_SHIFT, t0
	ldiq	t4, -0x4000
	sll	t4, 28, t4
	or	t0, t4, t0		# superpage mode

//      or      t0, IO_LONG_LEN, t0	# or in the byte enables

	stl	a1, (t0)		# write the longword
        mb                              # order the write
	ret	zero, (ra)
	
2:
//        BREAK_DEBUG_STOP                # _KDA_ don't want this access
        stl     a1, (a0)		# store the longword
	ret	zero, (ra)

    .end    WRITE_CONTROL_REGISTER_ULONG


#endif // ifdef MORGAN