blob: 73bef545e4d5a71c6ac113c6f4903ac18827c97c [file] [log] [blame]
Tomas Winkler9dc64d62013-01-08 23:07:17 +02001/*
2 *
Tomas Winkler66ef5ea2012-12-25 19:06:02 +02003 * Intel Management Engine Interface (Intel MEI) Linux driver
Tomas Winkler9dc64d62013-01-08 23:07:17 +02004 * Copyright (c) 2003-2012, Intel Corporation.
Tomas Winkler66ef5ea2012-12-25 19:06:02 +02005 *
Tomas Winkler9dc64d62013-01-08 23:07:17 +02006 * 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.
Tomas Winkler66ef5ea2012-12-25 19:06:02 +02009 *
Tomas Winkler9dc64d62013-01-08 23:07:17 +020010 * 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.
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020014 *
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020015 */
16
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020017
18
Tomas Winkler9dc64d62013-01-08 23:07:17 +020019#ifndef _MEI_INTERFACE_H_
20#define _MEI_INTERFACE_H_
21
22#include <linux/mei.h>
23#include "mei_dev.h"
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020024
25
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020026
Tomas Winkler9dc64d62013-01-08 23:07:17 +020027void mei_read_slots(struct mei_device *dev,
28 unsigned char *buffer,
29 unsigned long buffer_length);
30
31int mei_write_message(struct mei_device *dev,
32 struct mei_msg_hdr *header,
33 unsigned char *buf);
34
35bool mei_hbuf_is_empty(struct mei_device *dev);
36
37int mei_hbuf_empty_slots(struct mei_device *dev);
38
39static 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
44/* 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
50int mei_count_full_read_slots(struct mei_device *dev);
51
52#endif /* _MEI_INTERFACE_H_ */