appldata.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright IBM Corp. 2006
  3. *
  4. * Author(s): Melissa Howland <melissah@us.ibm.com>
  5. */
  6. #ifndef _ASM_S390_APPLDATA_H
  7. #define _ASM_S390_APPLDATA_H
  8. #include <asm/diag.h>
  9. #include <asm/io.h>
  10. #define APPLDATA_START_INTERVAL_REC 0x80
  11. #define APPLDATA_STOP_REC 0x81
  12. #define APPLDATA_GEN_EVENT_REC 0x82
  13. #define APPLDATA_START_CONFIG_REC 0x83
  14. /*
  15. * Parameter list for DIAGNOSE X'DC'
  16. */
  17. struct appldata_parameter_list {
  18. u16 diag;
  19. u8 function;
  20. u8 parlist_length;
  21. u32 unused01;
  22. u16 reserved;
  23. u16 buffer_length;
  24. u32 unused02;
  25. u64 product_id_addr;
  26. u64 buffer_addr;
  27. } __attribute__ ((packed));
  28. struct appldata_product_id {
  29. char prod_nr[7]; /* product number */
  30. u16 prod_fn; /* product function */
  31. u8 record_nr; /* record number */
  32. u16 version_nr; /* version */
  33. u16 release_nr; /* release */
  34. u16 mod_lvl; /* modification level */
  35. } __attribute__ ((packed));
  36. static inline int appldata_asm(struct appldata_product_id *id,
  37. unsigned short fn, void *buffer,
  38. unsigned short length)
  39. {
  40. struct appldata_parameter_list parm_list;
  41. int ry;
  42. if (!MACHINE_IS_VM)
  43. return -EOPNOTSUPP;
  44. parm_list.diag = 0xdc;
  45. parm_list.function = fn;
  46. parm_list.parlist_length = sizeof(parm_list);
  47. parm_list.buffer_length = length;
  48. parm_list.product_id_addr = (unsigned long) id;
  49. parm_list.buffer_addr = virt_to_phys(buffer);
  50. diag_stat_inc(DIAG_STAT_X0DC);
  51. asm volatile(
  52. " diag %1,%0,0xdc"
  53. : "=d" (ry)
  54. : "d" (&parm_list), "m" (parm_list), "m" (*id)
  55. : "cc");
  56. return ry;
  57. }
  58. #endif /* _ASM_S390_APPLDATA_H */