appldata.h 1.4 KB

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