blob: 90a3dfda9db5803a7db77a0cb700cda6f388f17e [file] [log] [blame]
Oren Weil3ce72722011-05-15 13:43:43 +03001/*
2 *
3 * Intel Management Engine Interface (Intel MEI) Linux driver
Tomas Winkler733ba912012-02-09 19:25:53 +02004 * Copyright (c) 2003-2012, Intel Corporation.
Oren Weil3ce72722011-05-15 13:43:43 +03005 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 */
16
17
18
19#ifndef _MEI_INTERFACE_H_
20#define _MEI_INTERFACE_H_
21
Tomas Winkler4f3afe12012-05-09 16:38:59 +030022#include <linux/mei.h>
Oren Weil3ce72722011-05-15 13:43:43 +030023#include "mei_dev.h"
24
25
Oren Weil3ce72722011-05-15 13:43:43 +030026
27void mei_read_slots(struct mei_device *dev,
Tomas Winkleredf1eed2012-02-09 19:25:54 +020028 unsigned char *buffer,
29 unsigned long buffer_length);
Oren Weil3ce72722011-05-15 13:43:43 +030030
31int mei_write_message(struct mei_device *dev,
Tomas Winkler438763f2012-12-25 19:05:59 +020032 struct mei_msg_hdr *header,
33 unsigned char *buf);
Oren Weil3ce72722011-05-15 13:43:43 +030034
Tomas Winkler726917f2012-06-25 23:46:28 +030035bool mei_hbuf_is_empty(struct mei_device *dev);
Oren Weil3ce72722011-05-15 13:43:43 +030036
Tomas Winkler726917f2012-06-25 23:46:28 +030037int mei_hbuf_empty_slots(struct mei_device *dev);
Oren Weil3ce72722011-05-15 13:43:43 +030038
Tomas Winkler24aadc82012-06-25 23:46:27 +030039static inline size_t mei_hbuf_max_data(const struct mei_device *dev)
40{
41 return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr);
42}
43
Tomas Winkler7bdf72d2012-07-04 19:24:52 +030044/* get slots (dwords) from a message length + header (bytes) */
45static inline unsigned char mei_data2slots(size_t length)
46{
47 return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4);
48}
49
Tomas Winkler726917f2012-06-25 23:46:28 +030050int mei_count_full_read_slots(struct mei_device *dev);
51
52
53int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl);
54
55
Tomas Winkler24aadc82012-06-25 23:46:27 +030056
Oren Weil3ce72722011-05-15 13:43:43 +030057int mei_wd_send(struct mei_device *dev);
Tomas Winklerc216fde2012-08-16 19:39:43 +030058int mei_wd_stop(struct mei_device *dev);
Tomas Winkler9487eb02012-04-03 23:34:58 +030059int mei_wd_host_init(struct mei_device *dev);
Tomas Winkler70cd5332011-12-22 18:50:50 +020060/*
61 * mei_watchdog_register - Registering watchdog interface
62 * once we got connection to the WD Client
63 * @dev - mei device
64 */
65void mei_watchdog_register(struct mei_device *dev);
66/*
Justin P. Mattock5f9092f2012-03-12 07:18:09 -070067 * mei_watchdog_unregister - Unregistering watchdog interface
Tomas Winkler70cd5332011-12-22 18:50:50 +020068 * @dev - mei device
69 */
70void mei_watchdog_unregister(struct mei_device *dev);
Oren Weil3ce72722011-05-15 13:43:43 +030071
Tomas Winkler8120e722012-12-25 19:06:11 +020072int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl);
Oren Weil3ce72722011-05-15 13:43:43 +030073int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl);
74
Tomas Winkler8120e722012-12-25 19:06:11 +020075void mei_hbm_start_req(struct mei_device *dev);
Oren Weil3ce72722011-05-15 13:43:43 +030076
Tomas Winkler8120e722012-12-25 19:06:11 +020077int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl);
78int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl);
79int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl);
80
81void mei_host_client_init(struct work_struct *work);
Oren Weil3ce72722011-05-15 13:43:43 +030082
83#endif /* _MEI_INTERFACE_H_ */