sclp.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * drivers/s390/char/sclp.h
  3. *
  4. * S390 version
  5. * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Martin Peschke <mpeschke@de.ibm.com>
  7. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. */
  9. #ifndef __SCLP_H__
  10. #define __SCLP_H__
  11. #include <linux/types.h>
  12. #include <linux/list.h>
  13. #include <asm/sclp.h>
  14. #include <asm/ebcdic.h>
  15. /* maximum number of pages concerning our own memory management */
  16. #define MAX_KMEM_PAGES (sizeof(unsigned long) << 3)
  17. #define MAX_CONSOLE_PAGES 4
  18. #define EVTYP_OPCMD 0x01
  19. #define EVTYP_MSG 0x02
  20. #define EVTYP_STATECHANGE 0x08
  21. #define EVTYP_PMSGCMD 0x09
  22. #define EVTYP_CNTLPROGOPCMD 0x20
  23. #define EVTYP_CNTLPROGIDENT 0x0B
  24. #define EVTYP_SIGQUIESCE 0x1D
  25. #define EVTYP_VT220MSG 0x1A
  26. #define EVTYP_SDIAS 0x1C
  27. #define EVTYP_OPCMD_MASK 0x80000000
  28. #define EVTYP_MSG_MASK 0x40000000
  29. #define EVTYP_STATECHANGE_MASK 0x01000000
  30. #define EVTYP_PMSGCMD_MASK 0x00800000
  31. #define EVTYP_CTLPROGOPCMD_MASK 0x00000001
  32. #define EVTYP_CTLPROGIDENT_MASK 0x00200000
  33. #define EVTYP_SIGQUIESCE_MASK 0x00000008
  34. #define EVTYP_VT220MSG_MASK 0x00000040
  35. #define EVTYP_SDIAS_MASK 0x00000010
  36. #define GNRLMSGFLGS_DOM 0x8000
  37. #define GNRLMSGFLGS_SNDALRM 0x4000
  38. #define GNRLMSGFLGS_HOLDMSG 0x2000
  39. #define LNTPFLGS_CNTLTEXT 0x8000
  40. #define LNTPFLGS_LABELTEXT 0x4000
  41. #define LNTPFLGS_DATATEXT 0x2000
  42. #define LNTPFLGS_ENDTEXT 0x1000
  43. #define LNTPFLGS_PROMPTTEXT 0x0800
  44. typedef unsigned int sclp_cmdw_t;
  45. #define SCLP_CMDW_READ_EVENT_DATA 0x00770005
  46. #define SCLP_CMDW_WRITE_EVENT_DATA 0x00760005
  47. #define SCLP_CMDW_WRITE_EVENT_MASK 0x00780005
  48. #define SCLP_CMDW_READ_SCP_INFO 0x00020001
  49. #define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001
  50. #define GDS_ID_MDSMU 0x1310
  51. #define GDS_ID_MDSROUTEINFO 0x1311
  52. #define GDS_ID_AGUNWRKCORR 0x1549
  53. #define GDS_ID_SNACONDREPORT 0x1532
  54. #define GDS_ID_CPMSU 0x1212
  55. #define GDS_ID_ROUTTARGINSTR 0x154D
  56. #define GDS_ID_OPREQ 0x8070
  57. #define GDS_ID_TEXTCMD 0x1320
  58. #define GDS_KEY_SELFDEFTEXTMSG 0x31
  59. typedef u32 sccb_mask_t; /* ATTENTION: assumes 32bit mask !!! */
  60. struct gds_subvector {
  61. u8 length;
  62. u8 key;
  63. } __attribute__((packed));
  64. struct gds_vector {
  65. u16 length;
  66. u16 gds_id;
  67. } __attribute__((packed));
  68. struct evbuf_header {
  69. u16 length;
  70. u8 type;
  71. u8 flags;
  72. u16 _reserved;
  73. } __attribute__((packed));
  74. struct sclp_req {
  75. struct list_head list; /* list_head for request queueing. */
  76. sclp_cmdw_t command; /* sclp command to execute */
  77. void *sccb; /* pointer to the sccb to execute */
  78. char status; /* status of this request */
  79. int start_count; /* number of SVCs done for this req */
  80. /* Callback that is called after reaching final status. */
  81. void (*callback)(struct sclp_req *, void *data);
  82. void *callback_data;
  83. };
  84. #define SCLP_REQ_FILLED 0x00 /* request is ready to be processed */
  85. #define SCLP_REQ_QUEUED 0x01 /* request is queued to be processed */
  86. #define SCLP_REQ_RUNNING 0x02 /* request is currently running */
  87. #define SCLP_REQ_DONE 0x03 /* request is completed successfully */
  88. #define SCLP_REQ_FAILED 0x05 /* request is finally failed */
  89. /* function pointers that a high level driver has to use for registration */
  90. /* of some routines it wants to be called from the low level driver */
  91. struct sclp_register {
  92. struct list_head list;
  93. /* event masks this user is registered for */
  94. sccb_mask_t receive_mask;
  95. sccb_mask_t send_mask;
  96. /* actually present events */
  97. sccb_mask_t sclp_receive_mask;
  98. sccb_mask_t sclp_send_mask;
  99. /* called if event type availability changes */
  100. void (*state_change_fn)(struct sclp_register *);
  101. /* called for events in cp_receive_mask/sclp_receive_mask */
  102. void (*receiver_fn)(struct evbuf_header *);
  103. };
  104. /* externals from sclp.c */
  105. int sclp_add_request(struct sclp_req *req);
  106. void sclp_sync_wait(void);
  107. int sclp_register(struct sclp_register *reg);
  108. void sclp_unregister(struct sclp_register *reg);
  109. int sclp_remove_processed(struct sccb_header *sccb);
  110. int sclp_deactivate(void);
  111. int sclp_reactivate(void);
  112. int sclp_service_call(sclp_cmdw_t command, void *sccb);
  113. /* useful inlines */
  114. /* VM uses EBCDIC 037, LPAR+native(SE+HMC) use EBCDIC 500 */
  115. /* translate single character from ASCII to EBCDIC */
  116. static inline unsigned char
  117. sclp_ascebc(unsigned char ch)
  118. {
  119. return (MACHINE_IS_VM) ? _ascebc[ch] : _ascebc_500[ch];
  120. }
  121. /* translate string from EBCDIC to ASCII */
  122. static inline void
  123. sclp_ebcasc_str(unsigned char *str, int nr)
  124. {
  125. (MACHINE_IS_VM) ? EBCASC(str, nr) : EBCASC_500(str, nr);
  126. }
  127. /* translate string from ASCII to EBCDIC */
  128. static inline void
  129. sclp_ascebc_str(unsigned char *str, int nr)
  130. {
  131. (MACHINE_IS_VM) ? ASCEBC(str, nr) : ASCEBC_500(str, nr);
  132. }
  133. #endif /* __SCLP_H__ */