xref: /openbmc/libmctp/libmctp-astlpc.h (revision b93b6112)
1 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2 
3 #ifndef _LIBMCTP_ASTLPCL_H
4 #define _LIBMCTP_ASTLPCL_H
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #include <libmctp.h>
11 
12 struct mctp_binding_astlpc;
13 
14 enum mctp_binding_astlpc_kcs_reg {
15 	MCTP_ASTLPC_KCS_REG_DATA = 0,
16 	MCTP_ASTLPC_KCS_REG_STATUS = 1,
17 };
18 
19 struct mctp_binding_astlpc_ops {
20 	int	(*kcs_read)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
21 			uint8_t *val);
22 	int	(*kcs_write)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
23 			uint8_t val);
24 	int	(*lpc_read)(void *data, void *buf, long offset, size_t len);
25 	int	(*lpc_write)(void *data, void *buf, long offset, size_t len);
26 };
27 
28 struct mctp_binding_astlpc *mctp_astlpc_init_ops(
29 		const struct mctp_binding_astlpc_ops *ops,
30 		void *ops_data, void *lpc_map);
31 void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc);
32 
33 struct mctp_binding *mctp_binding_astlpc_core(struct mctp_binding_astlpc *b);
34 
35 int mctp_astlpc_poll(struct mctp_binding_astlpc *astlpc);
36 
37 /* fileio-based interface */
38 struct mctp_binding_astlpc *mctp_astlpc_init_fileio(void);
39 int mctp_astlpc_get_fd(struct mctp_binding_astlpc *astlpc);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* _LIBMCTP_ASTLPC_H */
46