Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Intel Management Engine Interface (Intel MEI) Linux driver |
Tomas Winkler | 733ba91 | 2012-02-09 19:25:53 +0200 | [diff] [blame] | 4 | * Copyright (c) 2003-2012, Intel Corporation. |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 5 | * |
| 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 Winkler | 4f3afe1 | 2012-05-09 16:38:59 +0300 | [diff] [blame] | 22 | #include <linux/mei.h> |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 23 | #include "mei_dev.h" |
| 24 | |
| 25 | |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 26 | |
| 27 | void mei_read_slots(struct mei_device *dev, |
Tomas Winkler | edf1eed | 2012-02-09 19:25:54 +0200 | [diff] [blame] | 28 | unsigned char *buffer, |
| 29 | unsigned long buffer_length); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 30 | |
| 31 | int mei_write_message(struct mei_device *dev, |
| 32 | struct mei_msg_hdr *header, |
| 33 | unsigned char *write_buffer, |
| 34 | unsigned long write_length); |
| 35 | |
Tomas Winkler | 726917f | 2012-06-25 23:46:28 +0300 | [diff] [blame] | 36 | bool mei_hbuf_is_empty(struct mei_device *dev); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 37 | |
Tomas Winkler | 726917f | 2012-06-25 23:46:28 +0300 | [diff] [blame] | 38 | int mei_hbuf_empty_slots(struct mei_device *dev); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 39 | |
Tomas Winkler | 24aadc8 | 2012-06-25 23:46:27 +0300 | [diff] [blame] | 40 | static inline size_t mei_hbuf_max_data(const struct mei_device *dev) |
| 41 | { |
| 42 | return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr); |
| 43 | } |
| 44 | |
Tomas Winkler | 7bdf72d | 2012-07-04 19:24:52 +0300 | [diff] [blame] | 45 | /* get slots (dwords) from a message length + header (bytes) */ |
| 46 | static inline unsigned char mei_data2slots(size_t length) |
| 47 | { |
| 48 | return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4); |
| 49 | } |
| 50 | |
Tomas Winkler | 726917f | 2012-06-25 23:46:28 +0300 | [diff] [blame] | 51 | int mei_count_full_read_slots(struct mei_device *dev); |
| 52 | |
| 53 | |
| 54 | int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl); |
| 55 | |
| 56 | |
Tomas Winkler | 24aadc8 | 2012-06-25 23:46:27 +0300 | [diff] [blame] | 57 | |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 58 | int mei_wd_send(struct mei_device *dev); |
Tomas Winkler | c216fde | 2012-08-16 19:39:43 +0300 | [diff] [blame] | 59 | int mei_wd_stop(struct mei_device *dev); |
Tomas Winkler | 9487eb0 | 2012-04-03 23:34:58 +0300 | [diff] [blame] | 60 | int mei_wd_host_init(struct mei_device *dev); |
Tomas Winkler | 70cd533 | 2011-12-22 18:50:50 +0200 | [diff] [blame] | 61 | /* |
| 62 | * mei_watchdog_register - Registering watchdog interface |
| 63 | * once we got connection to the WD Client |
| 64 | * @dev - mei device |
| 65 | */ |
| 66 | void mei_watchdog_register(struct mei_device *dev); |
| 67 | /* |
Justin P. Mattock | 5f9092f | 2012-03-12 07:18:09 -0700 | [diff] [blame] | 68 | * mei_watchdog_unregister - Unregistering watchdog interface |
Tomas Winkler | 70cd533 | 2011-12-22 18:50:50 +0200 | [diff] [blame] | 69 | * @dev - mei device |
| 70 | */ |
| 71 | void mei_watchdog_unregister(struct mei_device *dev); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 72 | |
| 73 | int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl); |
| 74 | |
| 75 | int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl); |
| 76 | |
| 77 | int mei_disconnect(struct mei_device *dev, struct mei_cl *cl); |
| 78 | int mei_other_client_is_connecting(struct mei_device *dev, struct mei_cl *cl); |
| 79 | int mei_connect(struct mei_device *dev, struct mei_cl *cl); |
| 80 | |
| 81 | #endif /* _MEI_INTERFACE_H_ */ |