1 /* 2 * s390x io implementation 3 * 4 * Copyright (c) 2017 Red Hat Inc 5 * 6 * Authors: 7 * Thomas Huth <thuth@redhat.com> 8 * David Hildenbrand <david@redhat.com> 9 * 10 * This code is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU Library General Public License version 2. 12 */ 13 #include <libcflat.h> 14 #include <argv.h> 15 #include <asm/spinlock.h> 16 #include "sclp.h" 17 18 extern char ipl_args[]; 19 20 static struct spinlock lock; 21 22 void puts(const char *s) 23 { 24 spin_lock(&lock); 25 sclp_print(s); 26 spin_unlock(&lock); 27 } 28 29 static void sigp_stop() 30 { 31 register unsigned long status asm ("1") = 0; 32 register unsigned long cpu asm ("2") = 0; 33 34 asm volatile( 35 " sigp %0,%1,0(%2)\n" 36 : "+d" (status) : "d" (cpu), "d" (5) : "cc"); 37 } 38 39 void setup() 40 { 41 setup_args_progname(ipl_args); 42 sclp_setup(); 43 } 44 45 void exit(int code) 46 { 47 printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1); 48 sigp_stop(); 49 } 50