sclp_rw.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * interface to the SCLP-read/write driver
  3. *
  4. * Copyright IBM Corporation 1999, 2009
  5. *
  6. * Author(s): Martin Peschke <mpeschke@de.ibm.com>
  7. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. */
  9. #ifndef __SCLP_RW_H__
  10. #define __SCLP_RW_H__
  11. #include <linux/list.h>
  12. struct mto {
  13. u16 length;
  14. u16 type;
  15. u16 line_type_flags;
  16. u8 alarm_control;
  17. u8 _reserved[3];
  18. } __attribute__((packed));
  19. struct go {
  20. u16 length;
  21. u16 type;
  22. u32 domid;
  23. u8 hhmmss_time[8];
  24. u8 th_time[3];
  25. u8 reserved_0;
  26. u8 dddyyyy_date[7];
  27. u8 _reserved_1;
  28. u16 general_msg_flags;
  29. u8 _reserved_2[10];
  30. u8 originating_system_name[8];
  31. u8 job_guest_name[8];
  32. } __attribute__((packed));
  33. struct mdb_header {
  34. u16 length;
  35. u16 type;
  36. u32 tag;
  37. u32 revision_code;
  38. } __attribute__((packed));
  39. struct mdb {
  40. struct mdb_header header;
  41. struct go go;
  42. } __attribute__((packed));
  43. struct msg_buf {
  44. struct evbuf_header header;
  45. struct mdb mdb;
  46. } __attribute__((packed));
  47. struct write_sccb {
  48. struct sccb_header header;
  49. struct msg_buf msg_buf;
  50. } __attribute__((packed));
  51. /* The number of empty mto buffers that can be contained in a single sccb. */
  52. #define NR_EMPTY_MTO_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
  53. sizeof(struct write_sccb)) / sizeof(struct mto))
  54. /*
  55. * data structure for information about list of SCCBs (only for writing),
  56. * will be located at the end of a SCCBs page
  57. */
  58. struct sclp_buffer {
  59. struct list_head list; /* list_head for sccb_info chain */
  60. struct sclp_req request;
  61. struct write_sccb *sccb;
  62. char *current_line;
  63. int current_length;
  64. int retry_count;
  65. /* output format settings */
  66. unsigned short columns;
  67. unsigned short htab;
  68. /* statistics about this buffer */
  69. unsigned int mto_char_sum; /* # chars in sccb */
  70. unsigned int mto_number; /* # mtos in sccb */
  71. /* Callback that is called after reaching final status. */
  72. void (*callback)(struct sclp_buffer *, int);
  73. };
  74. int sclp_rw_init(void);
  75. struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
  76. void *sclp_unmake_buffer(struct sclp_buffer *);
  77. int sclp_buffer_space(struct sclp_buffer *);
  78. int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
  79. int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
  80. void sclp_set_columns(struct sclp_buffer *, unsigned short);
  81. void sclp_set_htab(struct sclp_buffer *, unsigned short);
  82. int sclp_chars_in_buffer(struct sclp_buffer *);
  83. #ifdef CONFIG_SCLP_CONSOLE
  84. void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event);
  85. #else
  86. static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { }
  87. #endif
  88. #endif /* __SCLP_RW_H__ */