Skip to content

Commit 94d3477

Browse files
committed
s390/head: get rid of 31 bit leftovers
Get rid of old 31 bit leftovers within ipl code: - convert everything to pc relative code - use 64 bit addressing mode as early as possible - use 64 bit arithmetics wherever possible This way the code doesn't look as odd as before anymore. Reviewed-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 8218827 commit 94d3477

File tree

1 file changed

+126
-149
lines changed

1 file changed

+126
-149
lines changed

arch/s390/boot/head.S

Lines changed: 126 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -29,202 +29,179 @@
2929
#include <asm/sclp.h>
3030
#include "boot.h"
3131

32-
#define ARCH_OFFSET 4
33-
3432
#define EP_OFFSET 0x10008
3533
#define EP_STRING "S390EP"
3634
#define IPL_BS 0x730
3735

3836
__HEAD
3937
ipl_start:
40-
j .Liplcont
41-
#
42-
# subroutine to wait for end I/O
43-
#
44-
.Lirqwait:
45-
larl %r13,.Lnewpsw # set up IO interrupt psw
46-
mvc __LC_IO_NEW_PSW(16),0(%r13)
47-
lpsw .Lwaitpsw
48-
.Lioint:
49-
br %r14
50-
.align 8
51-
.Lnewpsw:
52-
.quad 0x0000000080000000,.Lioint
53-
.Lwaitpsw:
54-
.long 0x020a0000,0x80000000+.Lioint
55-
56-
#
57-
# subroutine for loading cards from the reader
58-
#
59-
.Lloader:
60-
la %r4,0(%r14)
61-
la %r3,.Lorb # r2 = address of orb into r2
62-
la %r5,.Lirb # r4 = address of irb
63-
la %r6,.Lccws
64-
la %r7,20
65-
.Linit:
66-
st %r2,4(%r6) # initialize CCW data addresses
67-
la %r2,0x50(%r2)
68-
la %r6,8(%r6)
69-
bct 7,.Linit
70-
71-
lctl %c6,%c6,.Lcr6 # set IO subclass mask
72-
slr %r2,%r2
73-
.Lldlp:
74-
ssch 0(%r3) # load chunk of 1600 bytes
75-
bnz .Llderr
76-
.Lwait4irq:
77-
bas %r14,.Lirqwait
78-
c %r1,__LC_SUBCHANNEL_ID # compare subchannel number
79-
bne .Lwait4irq
80-
tsch 0(%r5)
81-
82-
slr %r0,%r0
83-
ic %r0,8(%r5) # get device status
84-
chi %r0,8 # channel end ?
85-
be .Lcont
86-
chi %r0,12 # channel end + device end ?
87-
be .Lcont
88-
89-
l %r0,4(%r5)
90-
s %r0,8(%r3) # r0/8 = number of ccws executed
91-
mhi %r0,10 # *10 = number of bytes in ccws
92-
lh %r3,10(%r5) # get residual count
93-
sr %r0,%r3 # #ccws*80-residual=#bytes read
94-
ar %r2,%r0
95-
96-
br %r4 # r2 contains the total size
97-
98-
.Lcont:
99-
ahi %r2,0x640 # add 0x640 to total size
100-
la %r6,.Lccws
101-
la %r7,20
102-
.Lincr:
103-
l %r0,4(%r6) # update CCW data addresses
104-
ahi %r0,0x640
105-
st %r0,4(%r6)
106-
ahi %r6,8
107-
bct 7,.Lincr
108-
109-
b .Lldlp
110-
.Llderr:
111-
lpsw .Lcrash
112-
113-
.align 8
114-
.Lorb: .long 0x00000000,0x0080ff00,.Lccws
115-
.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
116-
.Lcr6: .long 0xff000000
117-
.Lloadp:.long 0,0
118-
.align 8
119-
.Lcrash:.long 0x000a0000,0x00000000
120-
121-
.align 8
122-
.Lccws: .rept 19
123-
.long 0x02600050,0x00000000
124-
.endr
125-
.long 0x02200050,0x00000000
126-
127-
.Liplcont:
12838
mvi __LC_AR_MODE_ID,1 # set esame flag
12939
slr %r0,%r0 # set cpuid to zero
13040
lhi %r1,2 # mode 2 = esame (dump)
13141
sigp %r1,%r0,0x12 # switch to esame mode
132-
bras %r13,0f
133-
.fill 16,4,0x0
134-
0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
135-
sam31 # switch to 31 bit addressing mode
136-
lh %r1,__LC_SUBCHANNEL_ID # test if subchannel number
137-
bct %r1,.Lnoload # is valid
138-
l %r1,__LC_SUBCHANNEL_ID # load ipl subchannel number
139-
la %r2,IPL_BS # load start address
140-
bas %r14,.Lloader # load rest of ipl image
141-
l %r12,.Lparm # pointer to parameter area
142-
st %r1,IPL_DEVICE+ARCH_OFFSET-PARMAREA(%r12) # save ipl device number
143-
42+
sam64 # switch to 64 bit addressing mode
43+
lgh %r1,__LC_SUBCHANNEL_ID # test if subchannel number
44+
brctg %r1,.Lnoload # is valid
45+
llgf %r1,__LC_SUBCHANNEL_ID # load ipl subchannel number
46+
lghi %r2,IPL_BS # load start address
47+
bras %r14,.Lloader # load rest of ipl image
48+
larl %r12,parmarea # pointer to parameter area
49+
stg %r1,IPL_DEVICE-PARMAREA(%r12) # save ipl device number
14450
#
14551
# load parameter file from ipl device
14652
#
14753
.Lagain1:
148-
l %r2,.Linitrd # ramdisk loc. is temp
149-
bas %r14,.Lloader # load parameter file
150-
ltr %r2,%r2 # got anything ?
151-
bz .Lnopf
152-
l %r3,MAX_COMMAND_LINE_SIZE+ARCH_OFFSET-PARMAREA(%r12)
153-
ahi %r3,-1
154-
clr %r2,%r3
155-
bl .Lnotrunc
156-
lr %r2,%r3
54+
larl %r2,_end # ramdisk loc. is temp
55+
bras %r14,.Lloader # load parameter file
56+
ltgr %r2,%r2 # got anything ?
57+
jz .Lnopf
58+
lg %r3,MAX_COMMAND_LINE_SIZE-PARMAREA(%r12)
59+
aghi %r3,-1
60+
clgr %r2,%r3
61+
jl .Lnotrunc
62+
lgr %r2,%r3
15763
.Lnotrunc:
158-
l %r4,.Linitrd
64+
larl %r4,_end
15965
larl %r13,.L_hdr
16066
clc 0(3,%r4),0(%r13) # if it is HDRx
161-
bz .Lagain1 # skip dataset header
67+
jz .Lagain1 # skip dataset header
16268
larl %r13,.L_eof
16369
clc 0(3,%r4),0(%r13) # if it is EOFx
164-
bz .Lagain1 # skip dateset trailer
165-
166-
lr %r5,%r2
70+
jz .Lagain1 # skip dateset trailer
71+
lgr %r5,%r2
16772
la %r6,COMMAND_LINE-PARMAREA(%r12)
168-
lr %r7,%r2
169-
ahi %r7,1
73+
lgr %r7,%r2
74+
aghi %r7,1
17075
mvcl %r6,%r4
17176
.Lnopf:
172-
17377
#
17478
# load ramdisk from ipl device
17579
#
17680
.Lagain2:
177-
l %r2,.Linitrd # addr of ramdisk
178-
st %r2,INITRD_START+ARCH_OFFSET-PARMAREA(%r12)
179-
bas %r14,.Lloader # load ramdisk
180-
st %r2,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r12) # store size of rd
181-
ltr %r2,%r2
182-
bnz .Lrdcont
183-
st %r2,INITRD_START+ARCH_OFFSET-PARMAREA(%r12) # no ramdisk found
81+
larl %r2,_end # addr of ramdisk
82+
stg %r2,INITRD_START-PARMAREA(%r12)
83+
bras %r14,.Lloader # load ramdisk
84+
stg %r2,INITRD_SIZE-PARMAREA(%r12) # store size of rd
85+
ltgr %r2,%r2
86+
jnz .Lrdcont
87+
stg %r2,INITRD_START-PARMAREA(%r12) # no ramdisk found
18488
.Lrdcont:
185-
l %r2,.Linitrd
186-
89+
larl %r2,_end
18790
larl %r13,.L_hdr # skip HDRx and EOFx
18891
clc 0(3,%r2),0(%r13)
189-
bz .Lagain2
92+
jz .Lagain2
19093
larl %r13,.L_eof
19194
clc 0(3,%r2),0(%r13)
192-
bz .Lagain2
193-
95+
jz .Lagain2
19496
#
19597
# reset files in VM reader
19698
#
197-
stidp .Lcpuid # store cpuid
198-
tm .Lcpuid,0xff # running VM ?
199-
bno .Lnoreset
200-
la %r2,.Lreset
201-
lhi %r3,26
99+
larl %r13,.Lcpuid
100+
stidp 0(%r13) # store cpuid
101+
tm 0(%r13),0xff # running VM ?
102+
jno .Lnoreset
103+
larl %r2,.Lreset
104+
lghi %r3,26
202105
diag %r2,%r3,8
203-
la %r5,.Lirb
106+
larl %r5,.Lirb
204107
stsch 0(%r5) # check if irq is pending
205108
tm 30(%r5),0x0f # by verifying if any of the
206-
bnz .Lwaitforirq # activity or status control
109+
jnz .Lwaitforirq # activity or status control
207110
tm 31(%r5),0xff # bits is set in the schib
208-
bz .Lnoreset
111+
jz .Lnoreset
209112
.Lwaitforirq:
210-
bas %r14,.Lirqwait # wait for IO interrupt
113+
bras %r14,.Lirqwait # wait for IO interrupt
211114
c %r1,__LC_SUBCHANNEL_ID # compare subchannel number
212-
bne .Lwaitforirq
213-
la %r5,.Lirb
115+
jne .Lwaitforirq
116+
larl %r5,.Lirb
214117
tsch 0(%r5)
215118
.Lnoreset:
216-
b .Lnoload
217-
119+
j .Lnoload
218120
#
219121
# everything loaded, go for it
220122
#
221123
.Lnoload:
222-
l %r1,.Lstartup
223-
br %r1
124+
jg startup
125+
#
126+
# subroutine to wait for end I/O
127+
#
128+
.Lirqwait:
129+
larl %r13,.Lnewpswmask # set up IO interrupt psw
130+
mvc __LC_IO_NEW_PSW(8),0(%r13)
131+
stg %r14,__LC_IO_NEW_PSW+8
132+
larl %r13,.Lwaitpsw
133+
lpswe 0(%r13)
134+
.Lioint:
135+
#
136+
# subroutine for loading cards from the reader
137+
#
138+
.Lloader:
139+
lgr %r4,%r14
140+
larl %r3,.Lorb # r2 = address of orb into r2
141+
larl %r5,.Lirb # r4 = address of irb
142+
larl %r6,.Lccws
143+
lghi %r7,20
144+
.Linit:
145+
st %r2,4(%r6) # initialize CCW data addresses
146+
la %r2,0x50(%r2)
147+
la %r6,8(%r6)
148+
brctg %r7,.Linit
149+
larl %r13,.Lcr6
150+
lctlg %c6,%c6,0(%r13)
151+
xgr %r2,%r2
152+
.Lldlp:
153+
ssch 0(%r3) # load chunk of 1600 bytes
154+
jnz .Llderr
155+
.Lwait4irq:
156+
bras %r14,.Lirqwait
157+
c %r1,__LC_SUBCHANNEL_ID # compare subchannel number
158+
jne .Lwait4irq
159+
tsch 0(%r5)
160+
xgr %r0,%r0
161+
ic %r0,8(%r5) # get device status
162+
cghi %r0,8 # channel end ?
163+
je .Lcont
164+
cghi %r0,12 # channel end + device end ?
165+
je .Lcont
166+
llgf %r0,4(%r5)
167+
sgf %r0,8(%r3) # r0/8 = number of ccws executed
168+
mghi %r0,10 # *10 = number of bytes in ccws
169+
llgh %r3,10(%r5) # get residual count
170+
sgr %r0,%r3 # #ccws*80-residual=#bytes read
171+
agr %r2,%r0
172+
br %r4 # r2 contains the total size
173+
.Lcont:
174+
aghi %r2,0x640 # add 0x640 to total size
175+
larl %r6,.Lccws
176+
lghi %r7,20
177+
.Lincr:
178+
l %r0,4(%r6) # update CCW data addresses
179+
aghi %r0,0x640
180+
st %r0,4(%r6)
181+
aghi %r6,8
182+
brctg %r7,.Lincr
183+
j .Lldlp
184+
.Llderr:
185+
larl %r13,.Lcrash
186+
lpsw 0(%r13)
224187

225-
.Linitrd:.long _end # default address of initrd
226-
.Lparm: .long PARMAREA
227-
.Lstartup: .long startup
188+
.align 8
189+
.Lwaitpsw:
190+
.quad 0x0202000180000000,.Lioint
191+
.Lnewpswmask:
192+
.quad 0x0000000180000000
193+
.align 8
194+
.Lorb: .long 0x00000000,0x0080ff00,.Lccws
195+
.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
196+
.align 8
197+
.Lcr6: .quad 0x00000000ff000000
198+
.align 8
199+
.Lcrash:.long 0x000a0000,0x00000000
200+
.align 8
201+
.Lccws: .rept 19
202+
.long 0x02600050,0x00000000
203+
.endr
204+
.long 0x02200050,0x00000000
228205
.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
229206
.byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
230207
.byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold"

0 commit comments

Comments
 (0)