sclp_rw.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. struct mto mto;
  43. } __attribute__((packed));
  44. struct msg_buf {
  45. struct evbuf_header header;
  46. struct mdb mdb;
  47. } __attribute__((packed));
  48. /* The number of empty mto buffers that can be contained in a single sccb. */
  49. #define NR_EMPTY_MSG_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \
  50. sizeof(struct sccb_header)) / sizeof(struct msg_buf))
  51. /*
  52. * data structure for information about list of SCCBs (only for writing),
  53. * will be located at the end of a SCCBs page
  54. */
  55. struct sclp_buffer {
  56. struct list_head list; /* list_head for sccb_info chain */
  57. struct sclp_req request;
  58. void *sccb;
  59. struct msg_buf *current_msg;
  60. char *current_line;
  61. int current_length;
  62. int retry_count;
  63. /* output format settings */
  64. unsigned short columns;
  65. unsigned short htab;
  66. /* statistics about this buffer */
  67. unsigned int char_sum; /* # chars in sccb */
  68. unsigned int messages; /* # messages in sccb */
  69. /* Callback that is called after reaching final status. */
  70. void (*callback)(struct sclp_buffer *, int);
  71. };
  72. int sclp_rw_init(void);
  73. struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short);
  74. void *sclp_unmake_buffer(struct sclp_buffer *);
  75. int sclp_buffer_space(struct sclp_buffer *);
  76. int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
  77. int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
  78. void sclp_set_columns(struct sclp_buffer *, unsigned short);
  79. void sclp_set_htab(struct sclp_buffer *, unsigned short);
  80. int sclp_chars_in_buffer(struct sclp_buffer *);
  81. #ifdef CONFIG_SCLP_CONSOLE
  82. void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event);
  83. #else
  84. static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { }
  85. #endif
  86. #endif /* __SCLP_RW_H__ */