blob: 2ee14dc1b2ea55a8dc6c198640bb2f56034bf597 [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
Bjorn Helgaas81ec5502014-02-14 14:06:14 -070022#include <linux/irqreturn.h>
Tomas Winkler4ad96db2014-09-29 16:31:45 +030023#include <linux/pci.h>
24#include <linux/mei.h>
25
Tomas Winkler9dc64d62013-01-08 23:07:17 +020026#include "mei_dev.h"
Tomas Winkler52c34562013-02-06 14:06:40 +020027#include "client.h"
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020028
Tomas Winkler4ad96db2014-09-29 16:31:45 +030029/*
30 * mei_cfg - mei device configuration
31 *
32 * @fw_status: FW status
33 * @quirk_probe: device exclusion quirk
34 */
35struct mei_cfg {
36 const struct mei_fw_status fw_status;
37 bool (*quirk_probe)(struct pci_dev *pdev);
38};
39
40
41#define MEI_PCI_DEVICE(dev, cfg) \
42 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
43 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
44 .driver_data = (kernel_ulong_t)&(cfg)
45
46
Tomas Winkler180ea052014-03-18 22:52:02 +020047#define MEI_ME_RPM_TIMEOUT 500 /* ms */
48
Tomas Winkler4ad96db2014-09-29 16:31:45 +030049/**
Alexander Usyskince231392014-09-29 16:31:50 +030050 * struct mei_me_hw - me hw specific data
51 *
Tomas Winkler4ad96db2014-09-29 16:31:45 +030052 * @cfg: per device generation config and ops
Alexander Usyskinbb9f4d22015-08-02 22:20:51 +030053 * @mem_addr: io memory address
Alexander Usyskin1fa55b42015-08-02 22:20:52 +030054 * @intr_source: interrupt source
Alexander Usyskinbb9f4d22015-08-02 22:20:51 +030055 * @pg_state: power gating state
56 * @d0i3_supported: di03 support
Tomas Winkler4ad96db2014-09-29 16:31:45 +030057 */
Tomas Winkler52c34562013-02-06 14:06:40 +020058struct mei_me_hw {
Tomas Winkler4ad96db2014-09-29 16:31:45 +030059 const struct mei_cfg *cfg;
Tomas Winkler52c34562013-02-06 14:06:40 +020060 void __iomem *mem_addr;
Alexander Usyskin1fa55b42015-08-02 22:20:52 +030061 u32 intr_source;
Tomas Winklerba9cdd02014-03-18 22:52:00 +020062 enum mei_pg_state pg_state;
Alexander Usyskinbb9f4d22015-08-02 22:20:51 +030063 bool d0i3_supported;
Tomas Winkler52c34562013-02-06 14:06:40 +020064};
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020065
Tomas Winkler52c34562013-02-06 14:06:40 +020066#define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw)
67
Alexander Usyskin8d929d42014-05-13 01:30:53 +030068extern const struct mei_cfg mei_me_legacy_cfg;
69extern const struct mei_cfg mei_me_ich_cfg;
70extern const struct mei_cfg mei_me_pch_cfg;
Tomas Winklerc9199512014-05-13 01:30:54 +030071extern const struct mei_cfg mei_me_pch_cpt_pbg_cfg;
Alexander Usyskinedca5ea2014-11-19 17:01:38 +020072extern const struct mei_cfg mei_me_pch8_cfg;
73extern const struct mei_cfg mei_me_pch8_sps_cfg;
Alexander Usyskin8d929d42014-05-13 01:30:53 +030074
75struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
76 const struct mei_cfg *cfg);
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020077
Alexander Usyskin2d1995f2015-02-10 10:39:34 +020078int mei_me_pg_enter_sync(struct mei_device *dev);
79int mei_me_pg_exit_sync(struct mei_device *dev);
Tomas Winklerba9cdd02014-03-18 22:52:00 +020080
Tomas Winkler06ecd642013-02-06 14:06:42 +020081irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id);
82irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id);
83
Tomas Winkler9dc64d62013-01-08 23:07:17 +020084#endif /* _MEI_INTERFACE_H_ */