11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky * Copyright IBM Corp. 1999,2010 30ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * 40ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * Author(s): Hartmut Penner <hp@de.ibm.com> 50ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * Martin Schwidefsky <schwidefsky@de.ibm.com> 60ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * Rob van der Heij <rvdhei@iae.nl> 70ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * Heiko Carstens <heiko.carstens@de.ibm.com> 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * There are 5 different IPL methods 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1) load the image directly into ram at address 0 and do an PSW restart 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 2) linload will load the image from address 0x10000 to memory 0x10000 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * and start the code thru LPSW 0x0008000080010000 (VM only, deprecated) 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 3) generate the tape ipl header, store the generated image on a tape 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * and ipl from it 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * In case of SL tape you need to IPL 5 times to get past VOL1 etc 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 4) generate the vm reader ipl header, move the generated image to the 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * VM reader (use option NOH!) and do a ipl from reader (VM only) 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 5) direct call of start by the SALIPL loader 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * We use the cpuid to distinguish between VM and native ipl 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * params for kernel are pushed to 0x10400 (see setup.h) 210ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens * 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 242133bb8d8c691c08d47f16d5971ba98f0ac241bfTim Abbott#include <linux/init.h> 25144d634a21caff1d54cb4bb0d073774e88130045Jan Glauber#include <linux/linkage.h> 260013a85454c281faaf064ccb576e373a2881aac8Sam Ravnborg#include <asm/asm-offsets.h> 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/thread_info.h> 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/page.h> 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 30347a8dc3b815f0c0fa62a1df075184ffe4cbdcf1Martin Schwidefsky#ifdef CONFIG_64BIT 310ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens#define ARCH_OFFSET 4 320ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens#else 330ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens#define ARCH_OFFSET 0 340ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens#endif 350ad775dbba12de3b7d25f586efe81ad995ca75a7Heiko Carstens 362133bb8d8c691c08d47f16d5971ba98f0ac241bfTim Abbott__HEAD 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef CONFIG_IPL 3825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0 3925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+startup # Just a restart PSW 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_IPL_TAPE 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IPL_BS 1024 4325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0 4425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded 4525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x27000000,0x60000001 # by ipl to addresses 0-23. 4625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000000,0x20000000+IPL_BS # (a PSW and two CCWs). 4725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 # external old psw 4825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 # svc old psw 4925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 # program check old psw 5025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 # machine check old psw 5125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 # io old psw 5225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 5325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 5425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x00000000 5525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x000a0000,0x00000058 # external new psw 5625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x000a0000,0x00000060 # svc new psw 5725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x000a0000,0x00000068 # program check new psw 5825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x000a0000,0x00000070 # machine check new psw 5925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+.Lioint # io new psw 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 6125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0x100 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# subroutine for loading from tape 6498a1708de1bfa5fe1c490febba850d6043d3c7faMartin Olsson# Parameters: 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# R1 = device number 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# R2 = load address 6725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lloader: 6825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r14,.Lldret 6925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r3,.Lorbread # r3 = address of orb 7025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r5,.Lirb # r5 = address of irb 7125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r2,.Lccwread+4 # initialize CCW data addresses 7225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lctl %c6,%c6,.Lcr6 7325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r2,%r2 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lldlp: 7525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r6,3 # 3 retries 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lssch: 7725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ssch 0(%r3) # load chunk of IPL_BS bytes 7825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Llderr 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lw4end: 8025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lwait4io 8125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 8(%r5),0x82 # do we have a problem ? 8225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Lrecov 8325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r7,%r7 8425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens icm %r7,3,10(%r5) # get residual count 8525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lcr %r7,%r7 8625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r7,IPL_BS(%r7) # IPL_BS-residual=#bytes read 8725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ar %r2,%r7 # add to total size 8825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 8(%r5),0x01 # found a tape mark ? 8925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Ldone 9025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r0,.Lccwread+4 # update CCW data addresses 9125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ar %r0,%r7 9225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r0,.Lccwread+4 9325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Lldlp 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Ldone: 9525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r14,.Lldret 9625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens br %r14 # r2 contains the total size 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lrecov: 9825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lsense # do the sensing 9925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bct %r6,.Lssch # dec. retry count & branch 10025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Llderr 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# Sense subroutine 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lsense: 10525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r14,.Lsnsret 10625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r7,.Lorbsense 10725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ssch 0(%r7) # start sense command 10825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Llderr 10925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lwait4io 11025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r14,.Lsnsret 11125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 8(%r5),0x82 # do we have a problem ? 11225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Llderr 11325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens br %r14 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# Wait for interrupt subroutine 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lwait4io: 11825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lpsw .Lwaitpsw 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lioint: 12025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens c %r1,0xb8 # compare subchannel number 12125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bne .Lwait4io 12225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tsch 0(%r5) 12325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r0,%r0 12425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 8(%r5),0x82 # do we have a problem ? 12525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Lwtexit 12625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 8(%r5),0x04 # got device end ? 12725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lwait4io 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lwtexit: 12925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens br %r14 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Llderr: 13125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lpsw .Lcrash 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 13325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lorbread: 13525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x0080ff00,.Lccwread 13625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lorbsense: 13825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00000000,0x0080ff00,.Lccwsense 13925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lccwread: 14125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02200000+IPL_BS,0x00000000 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lccwsense: 14325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x04200001,0x00000000 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lwaitpsw: 14525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020a0000,0x80000000+.Lioint 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 14725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 14825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lcr6: .long 0xff000000 14925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 15025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lcrash:.long 0x000a0000,0x00000000 15125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lldret:.long 0 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lsnsret: .long 0 15325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens#endif /* CONFIG_IPL_TAPE */ 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_IPL_VM 15625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens#define IPL_BS 0x730 15725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0 15825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded 15925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000018,0x60000050 # by ipl to addresses 0-23. 16025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000068,0x60000050 # (a PSW and two CCWs). 16125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .fill 80-24,1,0x40 # bytes 24-79 are discarded !! 16225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020000f0,0x60000050 # The next 160 byte are loaded 16325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000140,0x60000050 # to addresses 0x18-0xb7 16425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000190,0x60000050 # They form the continuation 16525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020001e0,0x60000050 # of the CCW program started 16625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000230,0x60000050 # by ipl and load the range 16725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000280,0x60000050 # 0x0f0-0x730 from the image 16825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020002d0,0x60000050 # to the range 0x0f0-0x730 16925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000320,0x60000050 # in memory. At the end of 17025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000370,0x60000050 # the channel program the PSW 17125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020003c0,0x60000050 # at location 0 is loaded. 17225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000410,0x60000050 # Initial processing starts 17325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000460,0x60000050 # at 0xf0 = iplstart. 17425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020004b0,0x60000050 17525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000500,0x60000050 17625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000550,0x60000050 17725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020005a0,0x60000050 17825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020005f0,0x60000050 17925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000640,0x60000050 18025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02000690,0x60000050 18125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020006e0,0x20000050 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 18325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0xf0 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# subroutine for loading cards from the reader 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 18725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lloader: 18825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r3,.Lorb # r2 = address of orb into r2 18925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r5,.Lirb # r4 = address of irb 19025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r6,.Lccws 19125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r7,20 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Linit: 19325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r2,4(%r6) # initialize CCW data addresses 19425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r2,0x50(%r2) 19525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r6,8(%r6) 19625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bct 7,.Linit 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 19825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lctl %c6,%c6,.Lcr6 # set IO subclass mask 19925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r2,%r2 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lldlp: 20125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ssch 0(%r3) # load chunk of 1600 bytes 20225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Llderr 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lwait4irq: 20425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 0x78(8),.Lnewpsw # set up IO interrupt psw 20525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lpsw .Lwaitpsw 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lioint: 20725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens c %r1,0xb8 # compare subchannel number 20825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bne .Lwait4irq 20925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tsch 0(%r5) 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 21125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r0,%r0 21225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ic %r0,8(%r5) # get device status 21325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens chi %r0,8 # channel end ? 21425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens be .Lcont 21525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens chi %r0,12 # channel end + device end ? 21625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens be .Lcont 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 21825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r0,4(%r5) 21925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens s %r0,8(%r3) # r0/8 = number of ccws executed 22025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mhi %r0,10 # *10 = number of bytes in ccws 22125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lh %r3,10(%r5) # get residual count 22225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens sr %r0,%r3 # #ccws*80-residual=#bytes read 22325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ar %r2,%r0 22425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens 22525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens br %r14 # r2 contains the total size 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lcont: 22825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ahi %r2,0x640 # add 0x640 to total size 22925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r6,.Lccws 23025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r7,20 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lincr: 23225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r0,4(%r6) # update CCW data addresses 23325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ahi %r0,0x640 23425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r0,4(%r6) 23525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ahi %r6,8 23625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bct 7,.Lincr 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 23825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Lldlp 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Llderr: 24025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lpsw .Lcrash 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 24225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 24325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lorb: .long 0x00000000,0x0080ff00,.Lccws 24425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 24525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lcr6: .long 0xff000000 24625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lloadp:.long 0,0 24725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 24825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lcrash:.long 0x000a0000,0x00000000 2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lnewpsw: 25025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+.Lioint 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lwaitpsw: 25225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020a0000,0x80000000+.Lioint 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 25425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 25525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lccws: .rept 19 25625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02600050,0x00000000 25725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .endr 25825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x02200050,0x00000000 25925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens#endif /* CONFIG_IPL_VM */ 2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsiplstart: 26225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lh %r1,0xb8 # test if subchannel number 26325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bct %r1,.Lnoload # is valid 26425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r1,0xb8 # load ipl subchannel number 26525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r2,IPL_BS # load start address 26625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lloader # load rest of ipl image 26725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r12,.Lparm # pointer to parameter area 26825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r1,IPL_DEVICE+ARCH_OFFSET-PARMAREA(%r12) # save ipl device number 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# load parameter file from ipl device 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lagain1: 27425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r2,.Linitrd # ramdisk loc. is temp 27525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lloader # load parameter file 27625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ltr %r2,%r2 # got anything ? 27725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lnopf 27825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens chi %r2,895 27925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnh .Lnotrunc 28025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r2,895 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lnotrunc: 28225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r4,.Linitrd 28325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens clc 0(3,%r4),.L_hdr # if it is HDRx 28425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lagain1 # skip dataset header 28525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens clc 0(3,%r4),.L_eof # if it is EOFx 28625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lagain1 # skip dateset trailer 28725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r5,0(%r4,%r2) 28825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lr %r3,%r2 28961fd330dee1606a6bdb741f9c156bca386a4e438Martin Schwidefsky la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line 29025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 0(256,%r3),0(%r4) 29125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 256(256,%r3),256(%r4) 29225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 512(256,%r3),512(%r4) 29325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 768(122,%r3),768(%r4) 29425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r0,%r0 29525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Lcntlp 2961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Ldelspc: 29725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ic %r0,0(%r2,%r3) 29825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens chi %r0,0x20 # is it a space ? 29925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens be .Lcntlp 30025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ahi %r2,1 30125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Leolp 3021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lcntlp: 30325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens brct %r2,.Ldelspc 3041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Leolp: 30525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r0,%r0 30625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens stc %r0,0(%r2,%r3) # terminate buffer 3071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lnopf: 3081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 3101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# load ramdisk from ipl device 31125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens# 3121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lagain2: 31325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r2,.Linitrd # addr of ramdisk 31425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r2,INITRD_START+ARCH_OFFSET-PARMAREA(%r12) 31525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bas %r14,.Lloader # load ramdisk 31625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r2,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r12) # store size of rd 31725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ltr %r2,%r2 31825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Lrdcont 31925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r2,INITRD_START+ARCH_OFFSET-PARMAREA(%r12) # no ramdisk found 3201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lrdcont: 32125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r2,.Linitrd 3221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 32325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens clc 0(3,%r2),.L_hdr # skip HDRx and EOFx 32425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lagain2 32525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens clc 0(3,%r2),.L_eof 32625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lagain2 3271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_IPL_VM 3291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 3301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# reset files in VM reader 3311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 332c5328901aa1db134325607d65527742d8be07f7dMartin Schwidefsky stidp __LC_SAVE_AREA_SYNC # store cpuid 333c5328901aa1db134325607d65527742d8be07f7dMartin Schwidefsky tm __LC_SAVE_AREA_SYNC,0xff# running VM ? 33425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bno .Lnoreset 33525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r2,.Lreset 33625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lhi %r3,26 33725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens diag %r2,%r3,8 33825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r5,.Lirb 33925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens stsch 0(%r5) # check if irq is pending 34025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 30(%r5),0x0f # by verifying if any of the 34125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bnz .Lwaitforirq # activity or status control 34225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tm 31(%r5),0xff # bits is set in the schib 34325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bz .Lnoreset 344350e3ade9ed0809a94c51db6ee66883a35f0d6c9Heiko Carstens.Lwaitforirq: 34525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw 3462b071886170df456e230c38a3e504da4a11fff79Heiko Carstens.Lwaitrdrirq: 34725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens lpsw .Lrdrwaitpsw 3482b071886170df456e230c38a3e504da4a11fff79Heiko Carstens.Lrdrint: 34925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens c %r1,0xb8 # compare subchannel number 35025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bne .Lwaitrdrirq 35125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens la %r5,.Lirb 35225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tsch 0(%r5) 3531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lnoreset: 35425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .Lnoload 3552b071886170df456e230c38a3e504da4a11fff79Heiko Carstens 35625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .align 8 3572b071886170df456e230c38a3e504da4a11fff79Heiko Carstens.Lrdrnewpsw: 35825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x00080000,0x80000000+.Lrdrint 3592b071886170df456e230c38a3e504da4a11fff79Heiko Carstens.Lrdrwaitpsw: 36025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .long 0x020a0000,0x80000000+.Lrdrint 3611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 3622b071886170df456e230c38a3e504da4a11fff79Heiko Carstens 3631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 3641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# everything loaded, go for it 3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 3661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lnoload: 36725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r1,.Lstartup 36825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens br %r1 3691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 370e033b9a0c6ca137388e363a7250809f85b35eb3fHeiko Carstens.Linitrd:.long _end # default address of initrd 3711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lparm: .long PARMAREA 3721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.Lstartup: .long startup 37325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40 37425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6 37525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" 37625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.L_eof: .long 0xc5d6c600 /* C'EOF' */ 37725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.L_hdr: .long 0xc8c4d900 /* C'HDR' */ 3781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 37925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens#endif /* CONFIG_IPL */ 3801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 3821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# SALIPL loader support. Based on a patch by Rob van der Heij. 3831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# This entry point is called directly from the SALIPL loader and 3841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# doesn't need a builtin ipl record. 3851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# 38625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .org 0x800 387144d634a21caff1d54cb4bb0d073774e88130045Jan GlauberENTRY(start) 38825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens stm %r0,%r15,0x07b0 # store registers 38925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens basr %r12,%r0 3901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.base: 39125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r11,.parm 39225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens l %r8,.cmd # pointer to command buffer 3931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 39425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens ltr %r9,%r9 # do we have SALIPL parameters? 39525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens bp .sk8x8 3961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 39725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 0(64,%r8),0x00b0 # copy saved registers 39825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens xc 64(240-64,%r8),0(%r8) # remainder of buffer 39925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens tr 0(64,%r8),.lowcase 40025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens b .gotr 4011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.sk8x8: 40225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens mvc 0(240,%r8),0(%r9) # copy iplparms into buffer 4031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.gotr: 40425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens slr %r0,%r0 40525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11) 40625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11) 40725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens j startup # continue with startup 40825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.cmd: .long COMMAND_LINE # address of command line buffer 40925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens.parm: .long PARMAREA 4101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds.lowcase: 41125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 4121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f 41325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 4141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f 41525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 4161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f 41725d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 4181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f 41925d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47 4201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f 42125d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 4221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f 42325d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67 4241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f 42525d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 4261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f 4271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 42825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87 4291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f 43025d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97 4311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f 43225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 4331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf 43425d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7 4351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf 43625d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xc0,0x81,0x82,0x83,0x84,0x85,0x86,0x87 # .abcdefg 4371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x88,0x89,0xca,0xcb,0xcc,0xcd,0xce,0xcf # hi 43825d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xd0,0x91,0x92,0x93,0x94,0x95,0x96,0x97 # .jklmnop 4391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0x98,0x99,0xda,0xdb,0xdc,0xdd,0xde,0xdf # qr 4401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0xe0,0xe1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 # ..stuvwx 4411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0xa8,0xa9,0xea,0xeb,0xec,0xed,0xee,0xef # yz 44225d83cbfaa44e1b9170c0941c3ef52ca39f54cccHeiko Carstens .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 4431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 4441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 445e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# 446e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# startup-code at 0x10000, running in absolute addressing mode 447e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# this is called either by the ipl loader or directly by PSW restart 448e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# or linload or SALIPL 449e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# 450e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .org 0x10000 451144d634a21caff1d54cb4bb0d073774e88130045Jan GlauberENTRY(startup) 45260a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu j .Lep_startup_normal 45360a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .org 0x10008 45460a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# 45560a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# This is a list of s390 kernel entry points. At address 0x1000f the number of 45660a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# valid entry points is stored. 45760a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# 45860a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# IMPORTANT: Do not change this table, it is s390 kernel ABI! 45960a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# 46060a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .ascii "S390EP" 46160a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .byte 0x00,0x01 46260a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# 46360a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# kdump startup-code at 0x10010, running in 64 bit absolute addressing mode 46460a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu# 46560a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .org 0x10010 46660a0c68df2632feaa4a986af084650d1165d89c5Michael HolzheuENTRY(startup_kdump) 46760a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu j .Lep_startup_kdump 46860a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu.Lep_startup_normal: 4691844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky basr %r13,0 # get base 470e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky.LPG0: 471866ba28418d30122d863c50182a202741f4dcf3eMartin Schwidefsky xc 0x200(256),0x200 # partially clear lowcore 472866ba28418d30122d863c50182a202741f4dcf3eMartin Schwidefsky xc 0x300(256),0x300 47360a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu xc 0xe00(256),0xe00 4741844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky stck __LC_LAST_UPDATE_CLOCK 4751844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky spt 5f-.LPG0(%r13) 4761844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) 47737e37c20ab2dbccdc7a7fa5922e182a51adf50f6Michael Holzheu xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST 478e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#ifndef CONFIG_MARCH_G5 4798c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 4808838101183bba239f100b0cfe31d9ebbfc2f1bd4Martin Schwidefsky .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list 4818c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky tm __LC_STFL_FAC_LIST,0x01 # stfle available ? 4828c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky jz 0f 4838c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky la %r0,0 4848c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .insn s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended 4858c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky0: l %r0,__LC_STFL_FAC_LIST 4868c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky n %r0,2f+8-.LPG0(%r13) 4878c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky cl %r0,2f+8-.LPG0(%r13) 4888c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky jne 1f 4898c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky l %r0,__LC_STFL_FAC_LIST+4 4908c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky n %r0,2f+12-.LPG0(%r13) 4918c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky cl %r0,2f+12-.LPG0(%r13) 4928c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky je 3f 493d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens1: l %r15,.Lstack-.LPG0(%r13) 494d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens ahi %r15,-96 495d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens la %r2,.Lals_string-.LPG0(%r13) 496d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens l %r3,.Lsclp_print-.LPG0(%r13) 497d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens basr %r14,%r3 498d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens lpsw 2f-.LPG0(%r13) # machine type not good enough, crash 499d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens.Lals_string: 500d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens .asciz "The Linux kernel requires more recent processor hardware" 501d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens.Lsclp_print: 502d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens .long _sclp_print_early 503d90cbd469c9c7c1494fc2084af9319e6a557368bHeiko Carstens.Lstack: 5041844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER)) 505e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .align 16 5068c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky2: .long 0x000a0000,0x8badcccc 5078c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#if defined(CONFIG_64BIT) 508f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens#if defined(CONFIG_MARCH_Z196) 509f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens .long 0xc100efe3, 0xf46c0000 510f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens#elif defined(CONFIG_MARCH_Z10) 5118c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0xc100efe3, 0xf0680000 5128c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#elif defined(CONFIG_MARCH_Z9_109) 5138c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0xc100efc3, 0x00000000 5148c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#elif defined(CONFIG_MARCH_Z990) 5158c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0xc0002000, 0x00000000 5168c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#elif defined(CONFIG_MARCH_Z900) 5178c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0xc0000000, 0x00000000 5188c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#endif 5198c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#else 520f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens#if defined(CONFIG_MARCH_Z196) 521f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens .long 0x8100c880, 0x00000000 522f861e4057263033ad9134bfd6745f91b2165b351Heiko Carstens#elif defined(CONFIG_MARCH_Z10) 5238c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0x8100c880, 0x00000000 524e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#elif defined(CONFIG_MARCH_Z9_109) 5258c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0x8100c880, 0x00000000 526e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#elif defined(CONFIG_MARCH_Z990) 5278c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0x80002000, 0x00000000 528e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#elif defined(CONFIG_MARCH_Z900) 5298c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky .long 0x80000000, 0x00000000 5308c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky#endif 531e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#endif 5328c4caa4fbfc18aa50d9d682f502303a8e0d72726Martin Schwidefsky3: 533e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky#endif 534e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky 5351844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky#ifdef CONFIG_64BIT 5361844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky mvi __LC_AR_MODE_ID,1 # set esame flag 5371844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky slr %r0,%r0 # set cpuid to zero 5381844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky lhi %r1,2 # mode 2 = esame (dump) 5391844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky sigp %r1,%r0,0x12 # switch to esame mode 5401844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky sam64 # switch to 64 bit mode 54106c0dd72aea3985d0ea036f771ebb1d1083bf69fMartin Schwidefsky larl %r13,4f 54206c0dd72aea3985d0ea036f771ebb1d1083bf69fMartin Schwidefsky lmh %r0,%r15,0(%r13) # clear high-order half 5431844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky jg startup_continue 54406c0dd72aea3985d0ea036f771ebb1d1083bf69fMartin Schwidefsky4: .fill 16,4,0x0 5451844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky#else 5461844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) 547b6112ccbff5ec580d46b584ecc3c3a773b830da2Martin Schwidefsky l %r13,4f-.LPG0(%r13) 548e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky b 0(%r13) 5491844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky .align 8 550b6112ccbff5ec580d46b584ecc3c3a773b830da2Martin Schwidefsky4: .long startup_continue 5511844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky#endif 552ab96e798cbd562a53edd802272e49a5100b29efbMartin Schwidefsky .align 8 5531844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky5: .long 0x7fffffff,0xffffffff 554e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky 55560a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu#include "head_kdump.S" 55660a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu 557e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# 558e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# params at 10400 (setup.h) 559e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky# 560e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .org PARMAREA 561e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .long 0,0 # IPL_DEVICE 562e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .long 0,0 # INITRD_START 563e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .long 0,0 # INITRD_SIZE 56460a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .long 0,0 # OLDMEM_BASE 56560a0c68df2632feaa4a986af084650d1165d89c5Michael Holzheu .long 0,0 # OLDMEM_SIZE 566e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky 567e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .org COMMAND_LINE 568e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .byte "root=/dev/ram0 ro" 569e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky .byte 0 570e37f50e1811d68170e4d58a087cf634b2bf1cef9Martin Schwidefsky 5711844c9bc0b2fed3023551c1affe033ab38e90b9aMartin Schwidefsky .org 0x11000 572