1 /* 2 * Implementation of s390 diagnose codes 3 * 4 * Copyright IBM Corp. 2007 5 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 6 */ 7 8 #include <linux/module.h> 9 #include <asm/diag.h> 10 11 /* 12 * Diagnose 14: Input spool file manipulation 13 */ 14 int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode) 15 { 16 register unsigned long _ry1 asm("2") = ry1; 17 register unsigned long _ry2 asm("3") = subcode; 18 int rc = 0; 19 20 asm volatile( 21 #ifdef CONFIG_64BIT 22 " sam31\n" 23 " diag %2,2,0x14\n" 24 " sam64\n" 25 #else 26 " diag %2,2,0x14\n" 27 #endif 28 " ipm %0\n" 29 " srl %0,28\n" 30 : "=d" (rc), "+d" (_ry2) 31 : "d" (rx), "d" (_ry1) 32 : "cc"); 33 34 return rc; 35 } 36 EXPORT_SYMBOL(diag14); 37 38 /* 39 * Diagnose 210: Get information about a virtual device 40 */ 41 int diag210(struct diag210 *addr) 42 { 43 /* 44 * diag 210 needs its data below the 2GB border, so we 45 * use a static data area to be sure 46 */ 47 static struct diag210 diag210_tmp; 48 static DEFINE_SPINLOCK(diag210_lock); 49 unsigned long flags; 50 int ccode; 51 52 spin_lock_irqsave(&diag210_lock, flags); 53 diag210_tmp = *addr; 54 55 #ifdef CONFIG_64BIT 56 asm volatile( 57 " lhi %0,-1\n" 58 " sam31\n" 59 " diag %1,0,0x210\n" 60 "0: ipm %0\n" 61 " srl %0,28\n" 62 "1: sam64\n" 63 EX_TABLE(0b, 1b) 64 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory"); 65 #else 66 asm volatile( 67 " lhi %0,-1\n" 68 " diag %1,0,0x210\n" 69 "0: ipm %0\n" 70 " srl %0,28\n" 71 "1:\n" 72 EX_TABLE(0b, 1b) 73 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory"); 74 #endif 75 76 *addr = diag210_tmp; 77 spin_unlock_irqrestore(&diag210_lock, flags); 78 79 return ccode; 80 } 81 EXPORT_SYMBOL(diag210); 82