aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/head64.S
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2007-02-05 15:18:37 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-02-05 15:18:37 -0500
commitab14de6c37fae22911ba99f4171613e6d758050b (patch)
tree7545169fe9d64a82616ae37f2b6c1a420c77f30f /arch/s390/kernel/head64.S
parent31ee4b2f40994e8b21691f85cdd4052551a789b7 (diff)
[S390] Convert memory detection into C code.
Hopefully this will make it more maintainable and less error prone. Code makes use of search_exception_tables(). Since it calls this function before the kernel exeception table is sorted, there is an early call to sort_main_extable(). This way it's easy to use the already present infrastructure of fixup sections. Also this would allows to easily convert the rest of head[31|64].S into C code. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/head64.S')
-rw-r--r--arch/s390/kernel/head64.S175
1 files changed, 0 insertions, 175 deletions
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 030a1c95f47c..b8fec4e5c5d4 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -65,162 +65,6 @@ startup_continue:
65 brasl %r14,startup_init 65 brasl %r14,startup_init
66 # set program check new psw mask 66 # set program check new psw mask
67 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) 67 mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
68 larl %r1,.Lslowmemdetect # set program check address
69 stg %r1,__LC_PGM_NEW_PSW+8
70 lghi %r1,0xc
71 diag %r0,%r1,0x260 # get memory size of virtual machine
72 cgr %r0,%r1 # different? -> old detection routine
73 jne .Lslowmemdetect
74 larl %r3,ipl_flags
75 llgt %r3,0(%r3)
76 chi %r3,4 # ipled from an kernel NSS
77 je .Lslowmemdetect
78 aghi %r1,1 # size is one more than end
79 larl %r2,memory_chunk
80 stg %r1,8(%r2) # store size of chunk
81
82.Lslowmemdetect:
83 l %r2,.Lrcp-.LPG1(%r13) # Read SCP forced command word
84.Lservicecall:
85 stosm .Lpmask-.LPG1(%r13),0x01 # authorize ext interrupts
86
87 stctg %r0,%r0,.Lcr-.LPG1(%r13) # get cr0
88 la %r1,0x200 # set bit 22
89 og %r1,.Lcr-.LPG1(%r13) # or old cr0 with r1
90 stg %r1,.Lcr-.LPG1(%r13)
91 lctlg %r0,%r0,.Lcr-.LPG1(%r13) # load modified cr0
92
93 mvc __LC_EXT_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) # set postcall psw
94 larl %r1,.Lsclph
95 stg %r1,__LC_EXT_NEW_PSW+8 # set handler
96
97 larl %r4,.Lsccb # %r4 is our index for sccb stuff
98 lgr %r1,%r4 # our sccb
99 .insn rre,0xb2200000,%r2,%r1 # service call
100 ipm %r1
101 srl %r1,28 # get cc code
102 xr %r3,%r3
103 chi %r1,3
104 be .Lfchunk-.LPG1(%r13) # leave
105 chi %r1,2
106 be .Lservicecall-.LPG1(%r13)
107 lpswe .Lwaitsclp-.LPG1(%r13)
108.Lsclph:
109 lh %r1,.Lsccbr-.Lsccb(%r4)
110 chi %r1,0x10 # 0x0010 is the sucess code
111 je .Lprocsccb # let's process the sccb
112 chi %r1,0x1f0
113 bne .Lfchunk-.LPG1(%r13) # unhandled error code
114 c %r2,.Lrcp-.LPG1(%r13) # Did we try Read SCP forced
115 bne .Lfchunk-.LPG1(%r13) # if no, give up
116 l %r2,.Lrcp2-.LPG1(%r13) # try with Read SCP
117 b .Lservicecall-.LPG1(%r13)
118.Lprocsccb:
119 lghi %r1,0
120 icm %r1,3,.Lscpincr1-.Lsccb(%r4) # use this one if != 0
121 jnz .Lscnd
122 lg %r1,.Lscpincr2-.Lsccb(%r4) # otherwise use this one
123.Lscnd:
124 xr %r3,%r3 # same logic
125 ic %r3,.Lscpa1-.Lsccb(%r4)
126 chi %r3,0x00
127 jne .Lcompmem
128 l %r3,.Lscpa2-.Lsccb(%r4)
129.Lcompmem:
130 mlgr %r2,%r1 # mem in MB on 128-bit
131 l %r1,.Lonemb-.LPG1(%r13)
132 mlgr %r2,%r1 # mem size in bytes in %r3
133 b .Lfchunk-.LPG1(%r13)
134
135 .align 4
136.Lpmask:
137 .byte 0
138 .align 8
139.Lcr:
140 .quad 0x00 # place holder for cr0
141.Lwaitsclp:
142 .quad 0x0102000180000000,.Lsclph
143.Lrcp:
144 .int 0x00120001 # Read SCP forced code
145.Lrcp2:
146 .int 0x00020001 # Read SCP code
147.Lonemb:
148 .int 0x100000
149
150.Lfchunk:
151
152#
153# find memory chunks.
154#
155 larl %r9,memory_chunk # skip tprot loop if diag260
156 lg %r9,8(%r9) # memory detection was successful
157 ltgr %r9,%r9
158 jne .Ldonemem
159
160 lgr %r9,%r3 # end of mem
161 larl %r1,.Lchkmem # set program check address
162 stg %r1,__LC_PGM_NEW_PSW+8
163 la %r1,1 # test in increments of 128KB
164 sllg %r1,%r1,17
165 larl %r3,memory_chunk
166 slgr %r4,%r4 # set start of chunk to zero
167 slgr %r5,%r5 # set end of chunk to zero
168 slr %r6,%r6 # set access code to zero
169 la %r10,MEMORY_CHUNKS # number of chunks
170.Lloop:
171 tprot 0(%r5),0 # test protection of first byte
172 ipm %r7
173 srl %r7,28
174 clr %r6,%r7 # compare cc with last access code
175 je .Lsame
176 lghi %r8,0 # no program checks
177 j .Lsavchk
178.Lsame:
179 algr %r5,%r1 # add 128KB to end of chunk
180 # no need to check here,
181 brc 12,.Lloop # this is the same chunk
182.Lchkmem: # > 16EB or tprot got a program check
183 lghi %r8,1 # set program check flag
184.Lsavchk:
185 clgr %r4,%r5 # chunk size > 0?
186 je .Lchkloop
187 stg %r4,0(%r3) # store start address of chunk
188 lgr %r0,%r5
189 slgr %r0,%r4
190 stg %r0,8(%r3) # store size of chunk
191 st %r6,20(%r3) # store type of chunk
192 la %r3,24(%r3)
193 ahi %r10,-1 # update chunk number
194.Lchkloop:
195 lr %r6,%r7 # set access code to last cc
196 # we got an exception or we're starting a new
197 # chunk , we must check if we should
198 # still try to find valid memory (if we detected
199 # the amount of available storage), and if we
200 # have chunks left
201 lghi %r4,1
202 sllg %r4,%r4,31
203 clgr %r5,%r4
204 je .Lhsaskip
205 xr %r0, %r0
206 clgr %r0, %r9 # did we detect memory?
207 je .Ldonemem # if not, leave
208 chi %r10, 0 # do we have chunks left?
209 je .Ldonemem
210.Lhsaskip:
211 chi %r8,1 # program check ?
212 je .Lpgmchk
213 lgr %r4,%r5 # potential new chunk
214 algr %r5,%r1 # add 128KB to end of chunk
215 j .Llpcnt
216.Lpgmchk:
217 algr %r5,%r1 # add 128KB to end of chunk
218 lgr %r4,%r5 # potential new chunk
219.Llpcnt:
220 clgr %r5,%r9 # should we go on?
221 jl .Lloop
222.Ldonemem:
223
224 larl %r12,machine_flags 68 larl %r12,machine_flags
225# 69#
226# find out if we have the MVPG instruction 70# find out if we have the MVPG instruction
@@ -324,25 +168,6 @@ ipl_devno:
324 .word 0 168 .word 0
325 169
326 .org 0x12000 170 .org 0x12000
327.globl s390_readinfo_sccb
328s390_readinfo_sccb:
329.Lsccb:
330 .hword 0x1000 # length, one page
331 .byte 0x00,0x00,0x00
332 .byte 0x80 # variable response bit set
333.Lsccbr:
334 .hword 0x00 # response code
335.Lscpincr1:
336 .hword 0x00
337.Lscpa1:
338 .byte 0x00
339 .fill 89,1,0
340.Lscpa2:
341 .int 0x00
342.Lscpincr2:
343 .quad 0x00
344 .fill 3984,1,0
345 .org 0x13000
346 171
347#ifdef CONFIG_SHARED_KERNEL 172#ifdef CONFIG_SHARED_KERNEL
348 .org 0x100000 173 .org 0x100000