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 <asm/facility.h> 17 #include <asm/sigp.h> 18 #include "sclp.h" 19 #include "smp.h" 20 21 extern char ipl_args[]; 22 uint64_t stfl_doublewords[NB_STFL_DOUBLEWORDS]; 23 24 static struct spinlock lock; 25 26 void setup(void); 27 28 void puts(const char *s) 29 { 30 spin_lock(&lock); 31 sclp_print(s); 32 spin_unlock(&lock); 33 } 34 35 void setup(void) 36 { 37 setup_args_progname(ipl_args); 38 setup_facilities(); 39 sclp_console_setup(); 40 sclp_memory_setup(); 41 smp_setup(); 42 } 43 44 void exit(int code) 45 { 46 smp_teardown(); 47 printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1); 48 while (1) { 49 sigp(stap(), SIGP_STOP, 0, NULL); 50 } 51 } 52