appldata.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef CONFIG_64BIT
  10. #define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */
  11. #define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */
  12. #define APPLDATA_GEN_EVENT_REC 0x02
  13. #define APPLDATA_START_CONFIG_REC 0x03
  14. /*
  15. * Parameter list for DIAGNOSE X'DC'
  16. */
  17. struct appldata_parameter_list {
  18. u16 diag; /* The DIAGNOSE code X'00DC' */
  19. u8 function; /* The function code for the DIAGNOSE */
  20. u8 parlist_length; /* Length of the parameter list */
  21. u32 product_id_addr; /* Address of the 16-byte product ID */
  22. u16 reserved;
  23. u16 buffer_length; /* Length of the application data buffer */
  24. u32 buffer_addr; /* Address of the application data buffer */
  25. } __attribute__ ((packed));
  26. #else /* CONFIG_64BIT */
  27. #define APPLDATA_START_INTERVAL_REC 0x80
  28. #define APPLDATA_STOP_REC 0x81
  29. #define APPLDATA_GEN_EVENT_REC 0x82
  30. #define APPLDATA_START_CONFIG_REC 0x83
  31. /*
  32. * Parameter list for DIAGNOSE X'DC'
  33. */
  34. struct appldata_parameter_list {
  35. u16 diag;
  36. u8 function;
  37. u8 parlist_length;
  38. u32 unused01;
  39. u16 reserved;
  40. u16 buffer_length;
  41. u32 unused02;
  42. u64 product_id_addr;
  43. u64 buffer_addr;
  44. } __attribute__ ((packed));
  45. #endif /* CONFIG_64BIT */
  46. struct appldata_product_id {
  47. char prod_nr[7]; /* product number */
  48. u16 prod_fn; /* product function */
  49. u8 record_nr; /* record number */
  50. u16 version_nr; /* version */
  51. u16 release_nr; /* release */
  52. u16 mod_lvl; /* modification level */
  53. } __attribute__ ((packed));
  54. static inline int appldata_asm(struct appldata_product_id *id,
  55. unsigned short fn, void *buffer,
  56. unsigned short length)
  57. {
  58. struct appldata_parameter_list parm_list;
  59. int ry;
  60. if (!MACHINE_IS_VM)
  61. return -ENOSYS;
  62. parm_list.diag = 0xdc;
  63. parm_list.function = fn;
  64. parm_list.parlist_length = sizeof(parm_list);
  65. parm_list.buffer_length = length;
  66. parm_list.product_id_addr = (unsigned long) id;
  67. parm_list.buffer_addr = virt_to_phys(buffer);
  68. asm volatile(
  69. " diag %1,%0,0xdc"
  70. : "=d" (ry)
  71. : "d" (&parm_list), "m" (parm_list), "m" (*id)
  72. : "cc");
  73. return ry;
  74. }
  75. #endif /* _ASM_S390_APPLDATA_H */