sclp.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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_CONFMGMDATA 0x04
  27. #define EVTYP_SDIAS 0x1C
  28. #define EVTYP_OPCMD_MASK 0x80000000
  29. #define EVTYP_MSG_MASK 0x40000000
  30. #define EVTYP_STATECHANGE_MASK 0x01000000
  31. #define EVTYP_PMSGCMD_MASK 0x00800000
  32. #define EVTYP_CTLPROGOPCMD_MASK 0x00000001
  33. #define EVTYP_CTLPROGIDENT_MASK 0x00200000
  34. #define EVTYP_SIGQUIESCE_MASK 0x00000008
  35. #define EVTYP_VT220MSG_MASK 0x00000040
  36. #define EVTYP_CONFMGMDATA_MASK 0x10000000
  37. #define EVTYP_SDIAS_MASK 0x00000010
  38. #define GNRLMSGFLGS_DOM 0x8000
  39. #define GNRLMSGFLGS_SNDALRM 0x4000
  40. #define GNRLMSGFLGS_HOLDMSG 0x2000
  41. #define LNTPFLGS_CNTLTEXT 0x8000
  42. #define LNTPFLGS_LABELTEXT 0x4000
  43. #define LNTPFLGS_DATATEXT 0x2000
  44. #define LNTPFLGS_ENDTEXT 0x1000
  45. #define LNTPFLGS_PROMPTTEXT 0x0800
  46. typedef unsigned int sclp_cmdw_t;
  47. #define SCLP_CMDW_READ_EVENT_DATA 0x00770005
  48. #define SCLP_CMDW_WRITE_EVENT_DATA 0x00760005
  49. #define SCLP_CMDW_WRITE_EVENT_MASK 0x00780005
  50. #define SCLP_CMDW_READ_SCP_INFO 0x00020001
  51. #define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001
  52. #define GDS_ID_MDSMU 0x1310
  53. #define GDS_ID_MDSROUTEINFO 0x1311
  54. #define GDS_ID_AGUNWRKCORR 0x1549
  55. #define GDS_ID_SNACONDREPORT 0x1532
  56. #define GDS_ID_CPMSU 0x1212
  57. #define GDS_ID_ROUTTARGINSTR 0x154D
  58. #define GDS_ID_OPREQ 0x8070
  59. #define GDS_ID_TEXTCMD 0x1320
  60. #define GDS_KEY_SELFDEFTEXTMSG 0x31
  61. typedef u32 sccb_mask_t; /* ATTENTION: assumes 32bit mask !!! */
  62. struct gds_subvector {
  63. u8 length;
  64. u8 key;
  65. } __attribute__((packed));
  66. struct gds_vector {
  67. u16 length;
  68. u16 gds_id;
  69. } __attribute__((packed));
  70. struct evbuf_header {
  71. u16 length;
  72. u8 type;
  73. u8 flags;
  74. u16 _reserved;
  75. } __attribute__((packed));
  76. struct sclp_req {
  77. struct list_head list; /* list_head for request queueing. */
  78. sclp_cmdw_t command; /* sclp command to execute */
  79. void *sccb; /* pointer to the sccb to execute */
  80. char status; /* status of this request */
  81. int start_count; /* number of SVCs done for this req */
  82. /* Callback that is called after reaching final status. */
  83. void (*callback)(struct sclp_req *, void *data);
  84. void *callback_data;
  85. };
  86. #define SCLP_REQ_FILLED 0x00 /* request is ready to be processed */
  87. #define SCLP_REQ_QUEUED 0x01 /* request is queued to be processed */
  88. #define SCLP_REQ_RUNNING 0x02 /* request is currently running */
  89. #define SCLP_REQ_DONE 0x03 /* request is completed successfully */
  90. #define SCLP_REQ_FAILED 0x05 /* request is finally failed */
  91. /* function pointers that a high level driver has to use for registration */
  92. /* of some routines it wants to be called from the low level driver */
  93. struct sclp_register {
  94. struct list_head list;
  95. /* event masks this user is registered for */
  96. sccb_mask_t receive_mask;
  97. sccb_mask_t send_mask;
  98. /* actually present events */
  99. sccb_mask_t sclp_receive_mask;
  100. sccb_mask_t sclp_send_mask;
  101. /* called if event type availability changes */
  102. void (*state_change_fn)(struct sclp_register *);
  103. /* called for events in cp_receive_mask/sclp_receive_mask */
  104. void (*receiver_fn)(struct evbuf_header *);
  105. };
  106. /* externals from sclp.c */
  107. int sclp_add_request(struct sclp_req *req);
  108. void sclp_sync_wait(void);
  109. int sclp_register(struct sclp_register *reg);
  110. void sclp_unregister(struct sclp_register *reg);
  111. int sclp_remove_processed(struct sccb_header *sccb);
  112. int sclp_deactivate(void);
  113. int sclp_reactivate(void);
  114. int sclp_service_call(sclp_cmdw_t command, void *sccb);
  115. int sclp_sdias_init(void);
  116. void sclp_sdias_exit(void);
  117. /* useful inlines */
  118. /* VM uses EBCDIC 037, LPAR+native(SE+HMC) use EBCDIC 500 */
  119. /* translate single character from ASCII to EBCDIC */
  120. static inline unsigned char
  121. sclp_ascebc(unsigned char ch)
  122. {
  123. return (MACHINE_IS_VM) ? _ascebc[ch] : _ascebc_500[ch];
  124. }
  125. /* translate string from EBCDIC to ASCII */
  126. static inline void
  127. sclp_ebcasc_str(unsigned char *str, int nr)
  128. {
  129. (MACHINE_IS_VM) ? EBCASC(str, nr) : EBCASC_500(str, nr);
  130. }
  131. /* translate string from ASCII to EBCDIC */
  132. static inline void
  133. sclp_ascebc_str(unsigned char *str, int nr)
  134. {
  135. (MACHINE_IS_VM) ? ASCEBC(str, nr) : ASCEBC_500(str, nr);
  136. }
  137. #endif /* __SCLP_H__ */