appldata.h 2.2 KB

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