sclp.h 4.5 KB

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