1 /* SPDX-License-Identifier: GPL-2.0 */
5 #define VS_DATA_PACKET_HEADER 0xff
6 #define VS_CONTROL_PACKET_HEADER 0xfe
7 #define VS_QUERY_PACKET_HEADER 0xfd
8 #define VS_QUERY_RESPONSE_PACKET_HEADER 0xfc
11 #define VSV_SET_MODEM_CTL 1 /* to service processor only */
12 #define VSV_MODEM_CTL_UPDATE 2 /* from service processor only */
13 #define VSV_CLOSE_PROTOCOL 3
16 #define VSV_SEND_VERSION_NUMBER 1
17 #define VSV_SEND_MODEM_CTL_STATUS 2
19 /* yes, these masks are not consecutive. */
20 #define HVSI_TSDTR 0x01
21 #define HVSI_TSCD 0x20
23 #define HVSI_MAX_OUTGOING_DATA 12
24 #define HVSI_VERSION 1
30 } __attribute__((packed
));
33 struct hvsi_header hdr
;
34 uint8_t data
[HVSI_MAX_OUTGOING_DATA
];
35 } __attribute__((packed
));
38 struct hvsi_header hdr
;
40 /* optional depending on verb: */
43 } __attribute__((packed
));
46 struct hvsi_header hdr
;
48 } __attribute__((packed
));
50 struct hvsi_query_response
{
51 struct hvsi_header hdr
;
58 } __attribute__((packed
));
60 /* hvsi lib struct definitions */
61 #define HVSI_INBUF_SIZE 255
64 unsigned int inbuf_len
; /* data in input buffer */
65 unsigned char inbuf
[HVSI_INBUF_SIZE
];
66 unsigned int inbuf_cur
; /* Cursor in input buffer */
67 unsigned int inbuf_pktlen
; /* packet lenght from cursor */
68 atomic_t seqno
; /* packet sequence number */
69 unsigned int opened
:1; /* driver opened */
70 unsigned int established
:1; /* protocol established */
71 unsigned int is_console
:1; /* used as a kernel console device */
72 unsigned int mctrl_update
:1; /* modem control updated */
73 unsigned short mctrl
; /* modem control */
74 struct tty_struct
*tty
; /* tty structure */
75 int (*get_chars
)(uint32_t termno
, char *buf
, int count
);
76 int (*put_chars
)(uint32_t termno
, const char *buf
, int count
);
80 /* hvsi lib functions */
82 extern void hvsilib_init(struct hvsi_priv
*pv
,
83 int (*get_chars
)(uint32_t termno
, char *buf
, int count
),
84 int (*put_chars
)(uint32_t termno
, const char *buf
,
86 int termno
, int is_console
);
87 extern int hvsilib_open(struct hvsi_priv
*pv
, struct hvc_struct
*hp
);
88 extern void hvsilib_close(struct hvsi_priv
*pv
, struct hvc_struct
*hp
);
89 extern int hvsilib_read_mctrl(struct hvsi_priv
*pv
);
90 extern int hvsilib_write_mctrl(struct hvsi_priv
*pv
, int dtr
);
91 extern void hvsilib_establish(struct hvsi_priv
*pv
);
92 extern int hvsilib_get_chars(struct hvsi_priv
*pv
, char *buf
, int count
);
93 extern int hvsilib_put_chars(struct hvsi_priv
*pv
, const char *buf
, int count
);