blob: cf64847a35b94a9dd1f330b1287f62983f28151c [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
54 * @pg_state: power gating state
55 * @d0i3_supported: di03 support
Tomas Winkler4ad96db2014-09-29 16:31:45 +030056 */
Tomas Winkler52c34562013-02-06 14:06:40 +020057struct mei_me_hw {
Tomas Winkler4ad96db2014-09-29 16:31:45 +030058 const struct mei_cfg *cfg;
Tomas Winkler52c34562013-02-06 14:06:40 +020059 void __iomem *mem_addr;
Tomas Winklerba9cdd02014-03-18 22:52:00 +020060 enum mei_pg_state pg_state;
Alexander Usyskinbb9f4d22015-08-02 22:20:51 +030061 bool d0i3_supported;
Tomas Winkler52c34562013-02-06 14:06:40 +020062};
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020063
Tomas Winkler52c34562013-02-06 14:06:40 +020064#define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw)
65
Alexander Usyskin8d929d42014-05-13 01:30:53 +030066extern const struct mei_cfg mei_me_legacy_cfg;
67extern const struct mei_cfg mei_me_ich_cfg;
68extern const struct mei_cfg mei_me_pch_cfg;
Tomas Winklerc9199512014-05-13 01:30:54 +030069extern const struct mei_cfg mei_me_pch_cpt_pbg_cfg;
Alexander Usyskinedca5ea2014-11-19 17:01:38 +020070extern const struct mei_cfg mei_me_pch8_cfg;
71extern const struct mei_cfg mei_me_pch8_sps_cfg;
Alexander Usyskin8d929d42014-05-13 01:30:53 +030072
73struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
74 const struct mei_cfg *cfg);
Tomas Winkler66ef5ea2012-12-25 19:06:02 +020075
Alexander Usyskin2d1995f2015-02-10 10:39:34 +020076int mei_me_pg_enter_sync(struct mei_device *dev);
77int mei_me_pg_exit_sync(struct mei_device *dev);
Tomas Winklerba9cdd02014-03-18 22:52:00 +020078
Tomas Winkler06ecd642013-02-06 14:06:42 +020079irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id);
80irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id);
81
Tomas Winkler9dc64d62013-01-08 23:07:17 +020082#endif /* _MEI_INTERFACE_H_ */