Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 1 | /* |
| 2 | * |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 3 | * Intel Management Engine Interface (Intel MEI) Linux driver |
Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 4 | * Copyright (c) 2003-2012, Intel Corporation. |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 5 | * |
Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 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. |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 9 | * |
Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 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. |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 14 | * |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 17 | |
| 18 | |
Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 19 | #ifndef _MEI_INTERFACE_H_ |
| 20 | #define _MEI_INTERFACE_H_ |
| 21 | |
| 22 | #include <linux/mei.h> |
| 23 | #include "mei_dev.h" |
Tomas Winkler | 52c3456 | 2013-02-06 14:06:40 +0200 | [diff] [blame^] | 24 | #include "client.h" |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 25 | |
Tomas Winkler | 52c3456 | 2013-02-06 14:06:40 +0200 | [diff] [blame^] | 26 | struct mei_me_hw { |
| 27 | void __iomem *mem_addr; |
| 28 | /* |
| 29 | * hw states of host and fw(ME) |
| 30 | */ |
| 31 | u32 host_hw_state; |
| 32 | u32 me_hw_state; |
| 33 | }; |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 34 | |
Tomas Winkler | 52c3456 | 2013-02-06 14:06:40 +0200 | [diff] [blame^] | 35 | #define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw) |
| 36 | |
| 37 | struct mei_device *mei_me_dev_init(struct pci_dev *pdev); |
Tomas Winkler | 66ef5ea | 2012-12-25 19:06:02 +0200 | [diff] [blame] | 38 | |
Tomas Winkler | 9dc64d6 | 2013-01-08 23:07:17 +0200 | [diff] [blame] | 39 | void mei_read_slots(struct mei_device *dev, |
| 40 | unsigned char *buffer, |
| 41 | unsigned long buffer_length); |
| 42 | |
| 43 | int mei_write_message(struct mei_device *dev, |
| 44 | struct mei_msg_hdr *header, |
| 45 | unsigned char *buf); |
| 46 | |
| 47 | bool mei_hbuf_is_empty(struct mei_device *dev); |
| 48 | |
| 49 | int mei_hbuf_empty_slots(struct mei_device *dev); |
| 50 | |
| 51 | static inline size_t mei_hbuf_max_data(const struct mei_device *dev) |
| 52 | { |
| 53 | return dev->hbuf_depth * sizeof(u32) - sizeof(struct mei_msg_hdr); |
| 54 | } |
| 55 | |
| 56 | /* get slots (dwords) from a message length + header (bytes) */ |
| 57 | static inline unsigned char mei_data2slots(size_t length) |
| 58 | { |
| 59 | return DIV_ROUND_UP(sizeof(struct mei_msg_hdr) + length, 4); |
| 60 | } |
| 61 | |
| 62 | int mei_count_full_read_slots(struct mei_device *dev); |
| 63 | |
| 64 | #endif /* _MEI_INTERFACE_H_ */ |