2019-03-12 01:10:41 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2013-01-09 01:07:17 +04:00
|
|
|
/*
|
2020-06-19 19:51:15 +03:00
|
|
|
* Copyright (c) 2012-2020, Intel Corporation. All rights reserved.
|
2013-01-09 01:07:17 +04:00
|
|
|
* Intel Management Engine Interface (Intel MEI) Linux driver
|
2012-12-25 21:06:02 +04:00
|
|
|
*/
|
|
|
|
|
2013-01-09 01:07:17 +04:00
|
|
|
#ifndef _MEI_INTERFACE_H_
|
|
|
|
#define _MEI_INTERFACE_H_
|
2012-12-25 21:06:02 +04:00
|
|
|
|
2014-02-15 01:06:14 +04:00
|
|
|
#include <linux/irqreturn.h>
|
2014-09-29 17:31:45 +04:00
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/mei.h>
|
|
|
|
|
2013-01-09 01:07:17 +04:00
|
|
|
#include "mei_dev.h"
|
2013-02-06 16:06:40 +04:00
|
|
|
#include "client.h"
|
2012-12-25 21:06:02 +04:00
|
|
|
|
2014-09-29 17:31:45 +04:00
|
|
|
/*
|
|
|
|
* mei_cfg - mei device configuration
|
|
|
|
*
|
|
|
|
* @fw_status: FW status
|
|
|
|
* @quirk_probe: device exclusion quirk
|
2020-07-28 22:22:42 +03:00
|
|
|
* @kind: MEI head kind
|
2018-07-31 09:35:37 +03:00
|
|
|
* @dma_size: device DMA buffers size
|
2019-10-04 21:17:22 +03:00
|
|
|
* @fw_ver_supported: is fw version retrievable from FW
|
2019-11-07 13:44:45 +03:00
|
|
|
* @hw_trc_supported: does the hw support trc register
|
2014-09-29 17:31:45 +04:00
|
|
|
*/
|
|
|
|
struct mei_cfg {
|
|
|
|
const struct mei_fw_status fw_status;
|
2020-06-19 19:51:16 +03:00
|
|
|
bool (*quirk_probe)(const struct pci_dev *pdev);
|
2020-07-28 22:22:42 +03:00
|
|
|
const char *kind;
|
2018-07-31 09:35:37 +03:00
|
|
|
size_t dma_size[DMA_DSCR_NUM];
|
2019-10-04 21:17:22 +03:00
|
|
|
u32 fw_ver_supported:1;
|
2019-11-07 13:44:45 +03:00
|
|
|
u32 hw_trc_supported:1;
|
2014-09-29 17:31:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define MEI_PCI_DEVICE(dev, cfg) \
|
|
|
|
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
|
|
|
|
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
|
2017-06-14 10:03:15 +03:00
|
|
|
.driver_data = (kernel_ulong_t)(cfg),
|
2014-09-29 17:31:45 +04:00
|
|
|
|
2014-03-19 00:52:02 +04:00
|
|
|
#define MEI_ME_RPM_TIMEOUT 500 /* ms */
|
|
|
|
|
2014-09-29 17:31:45 +04:00
|
|
|
/**
|
2014-09-29 17:31:50 +04:00
|
|
|
* struct mei_me_hw - me hw specific data
|
|
|
|
*
|
2014-09-29 17:31:45 +04:00
|
|
|
* @cfg: per device generation config and ops
|
2015-08-02 22:20:51 +03:00
|
|
|
* @mem_addr: io memory address
|
2019-11-07 01:38:40 +03:00
|
|
|
* @irq: irq number
|
2015-08-02 22:20:51 +03:00
|
|
|
* @pg_state: power gating state
|
|
|
|
* @d0i3_supported: di03 support
|
2018-07-23 13:21:23 +03:00
|
|
|
* @hbuf_depth: depth of hardware host/write buffer in slots
|
2019-11-07 01:38:41 +03:00
|
|
|
* @read_fws: read FW status register handler
|
2014-09-29 17:31:45 +04:00
|
|
|
*/
|
2013-02-06 16:06:40 +04:00
|
|
|
struct mei_me_hw {
|
2014-09-29 17:31:45 +04:00
|
|
|
const struct mei_cfg *cfg;
|
2013-02-06 16:06:40 +04:00
|
|
|
void __iomem *mem_addr;
|
2019-11-07 01:38:40 +03:00
|
|
|
int irq;
|
2014-03-19 00:52:00 +04:00
|
|
|
enum mei_pg_state pg_state;
|
2015-08-02 22:20:51 +03:00
|
|
|
bool d0i3_supported;
|
2018-07-23 13:21:23 +03:00
|
|
|
u8 hbuf_depth;
|
2019-11-07 01:38:41 +03:00
|
|
|
int (*read_fws)(const struct mei_device *dev, int where, u32 *val);
|
2013-02-06 16:06:40 +04:00
|
|
|
};
|
2012-12-25 21:06:02 +04:00
|
|
|
|
2013-02-06 16:06:40 +04:00
|
|
|
#define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw)
|
|
|
|
|
2017-06-14 10:03:15 +03:00
|
|
|
/**
|
|
|
|
* enum mei_cfg_idx - indices to platform specific configurations.
|
|
|
|
*
|
|
|
|
* Note: has to be synchronized with mei_cfg_list[]
|
|
|
|
*
|
|
|
|
* @MEI_ME_UNDEF_CFG: Lower sentinel.
|
|
|
|
* @MEI_ME_ICH_CFG: I/O Controller Hub legacy devices.
|
|
|
|
* @MEI_ME_ICH10_CFG: I/O Controller Hub platforms Gen10
|
2019-10-04 21:17:22 +03:00
|
|
|
* @MEI_ME_PCH6_CFG: Platform Controller Hub platforms (Gen6).
|
|
|
|
* @MEI_ME_PCH7_CFG: Platform Controller Hub platforms (Gen7).
|
2017-06-14 10:03:15 +03:00
|
|
|
* @MEI_ME_PCH_CPT_PBG_CFG:Platform Controller Hub workstations
|
|
|
|
* with quirk for Node Manager exclusion.
|
|
|
|
* @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer
|
|
|
|
* client platforms.
|
2020-07-28 22:22:42 +03:00
|
|
|
* @MEI_ME_PCH8_ITOUCH_CFG:Platform Controller Hub Gen8 and newer
|
|
|
|
* client platforms (iTouch).
|
2020-06-19 19:51:15 +03:00
|
|
|
* @MEI_ME_PCH8_SPS_4_CFG: Platform Controller Hub Gen8 and newer
|
2017-06-14 10:03:15 +03:00
|
|
|
* servers platforms with quirk for
|
|
|
|
* SPS firmware exclusion.
|
2018-07-31 09:35:37 +03:00
|
|
|
* @MEI_ME_PCH12_CFG: Platform Controller Hub Gen12 and newer
|
2020-06-19 19:51:15 +03:00
|
|
|
* @MEI_ME_PCH12_SPS_4_CFG:Platform Controller Hub Gen12 up to 4.0
|
|
|
|
* servers platforms with quirk for
|
|
|
|
* SPS firmware exclusion.
|
|
|
|
* @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 5.0 and newer
|
2020-04-29 00:12:00 +03:00
|
|
|
* servers platforms with quirk for
|
|
|
|
* SPS firmware exclusion.
|
2019-11-07 13:44:45 +03:00
|
|
|
* @MEI_ME_PCH15_CFG: Platform Controller Hub Gen15 and newer
|
2020-06-19 19:51:21 +03:00
|
|
|
* @MEI_ME_PCH15_SPS_CFG: Platform Controller Hub Gen15 and newer
|
|
|
|
* servers platforms with quirk for
|
|
|
|
* SPS firmware exclusion.
|
2017-06-14 10:03:15 +03:00
|
|
|
* @MEI_ME_NUM_CFG: Upper Sentinel.
|
|
|
|
*/
|
|
|
|
enum mei_cfg_idx {
|
|
|
|
MEI_ME_UNDEF_CFG,
|
|
|
|
MEI_ME_ICH_CFG,
|
|
|
|
MEI_ME_ICH10_CFG,
|
2019-10-04 21:17:22 +03:00
|
|
|
MEI_ME_PCH6_CFG,
|
|
|
|
MEI_ME_PCH7_CFG,
|
2017-06-14 10:03:15 +03:00
|
|
|
MEI_ME_PCH_CPT_PBG_CFG,
|
|
|
|
MEI_ME_PCH8_CFG,
|
2020-07-28 22:22:42 +03:00
|
|
|
MEI_ME_PCH8_ITOUCH_CFG,
|
2020-06-19 19:51:15 +03:00
|
|
|
MEI_ME_PCH8_SPS_4_CFG,
|
2018-07-31 09:35:37 +03:00
|
|
|
MEI_ME_PCH12_CFG,
|
2020-06-19 19:51:15 +03:00
|
|
|
MEI_ME_PCH12_SPS_4_CFG,
|
2020-04-29 00:12:00 +03:00
|
|
|
MEI_ME_PCH12_SPS_CFG,
|
2020-07-28 22:22:42 +03:00
|
|
|
MEI_ME_PCH12_SPS_ITOUCH_CFG,
|
2019-11-07 13:44:45 +03:00
|
|
|
MEI_ME_PCH15_CFG,
|
2020-06-19 19:51:21 +03:00
|
|
|
MEI_ME_PCH15_SPS_CFG,
|
2017-06-14 10:03:15 +03:00
|
|
|
MEI_ME_NUM_CFG,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx);
|
2014-05-13 02:30:53 +04:00
|
|
|
|
2019-11-07 01:38:39 +03:00
|
|
|
struct mei_device *mei_me_dev_init(struct device *parent,
|
2014-05-13 02:30:53 +04:00
|
|
|
const struct mei_cfg *cfg);
|
2012-12-25 21:06:02 +04:00
|
|
|
|
2015-02-10 11:39:34 +03:00
|
|
|
int mei_me_pg_enter_sync(struct mei_device *dev);
|
|
|
|
int mei_me_pg_exit_sync(struct mei_device *dev);
|
2014-03-19 00:52:00 +04:00
|
|
|
|
2013-02-06 16:06:42 +04:00
|
|
|
irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id);
|
|
|
|
irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id);
|
|
|
|
|
2013-01-09 01:07:17 +04:00
|
|
|
#endif /* _MEI_INTERFACE_H_ */
|