diag.c 1.3 KB

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