19dc64d6aSTomas Winkler /* 29dc64d6aSTomas Winkler * 366ef5ea9STomas Winkler * Intel Management Engine Interface (Intel MEI) Linux driver 49dc64d6aSTomas Winkler * Copyright (c) 2003-2012, Intel Corporation. 566ef5ea9STomas Winkler * 69dc64d6aSTomas Winkler * This program is free software; you can redistribute it and/or modify it 79dc64d6aSTomas Winkler * under the terms and conditions of the GNU General Public License, 89dc64d6aSTomas Winkler * version 2, as published by the Free Software Foundation. 966ef5ea9STomas Winkler * 109dc64d6aSTomas Winkler * This program is distributed in the hope it will be useful, but WITHOUT 119dc64d6aSTomas Winkler * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 129dc64d6aSTomas Winkler * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 139dc64d6aSTomas Winkler * more details. 1466ef5ea9STomas Winkler * 1566ef5ea9STomas Winkler */ 1666ef5ea9STomas Winkler 1766ef5ea9STomas Winkler 1866ef5ea9STomas Winkler 199dc64d6aSTomas Winkler #ifndef _MEI_INTERFACE_H_ 209dc64d6aSTomas Winkler #define _MEI_INTERFACE_H_ 219dc64d6aSTomas Winkler 2281ec5502SBjorn Helgaas #include <linux/irqreturn.h> 234ad96db6STomas Winkler #include <linux/pci.h> 244ad96db6STomas Winkler #include <linux/mei.h> 254ad96db6STomas Winkler 269dc64d6aSTomas Winkler #include "mei_dev.h" 2752c34561STomas Winkler #include "client.h" 2866ef5ea9STomas Winkler 294ad96db6STomas Winkler /* 304ad96db6STomas Winkler * mei_cfg - mei device configuration 314ad96db6STomas Winkler * 324ad96db6STomas Winkler * @fw_status: FW status 334ad96db6STomas Winkler * @quirk_probe: device exclusion quirk 344ad96db6STomas Winkler */ 354ad96db6STomas Winkler struct mei_cfg { 364ad96db6STomas Winkler const struct mei_fw_status fw_status; 374ad96db6STomas Winkler bool (*quirk_probe)(struct pci_dev *pdev); 384ad96db6STomas Winkler }; 394ad96db6STomas Winkler 404ad96db6STomas Winkler 414ad96db6STomas Winkler #define MEI_PCI_DEVICE(dev, cfg) \ 424ad96db6STomas Winkler .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ 434ad96db6STomas Winkler .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ 44*f5ac3c49STomas Winkler .driver_data = (kernel_ulong_t)(cfg), 454ad96db6STomas Winkler 46180ea05bSTomas Winkler #define MEI_ME_RPM_TIMEOUT 500 /* ms */ 47180ea05bSTomas Winkler 484ad96db6STomas Winkler /** 49ce23139cSAlexander Usyskin * struct mei_me_hw - me hw specific data 50ce23139cSAlexander Usyskin * 514ad96db6STomas Winkler * @cfg: per device generation config and ops 52ce23139cSAlexander Usyskin * @mem_addr: io memory address 53ce23139cSAlexander Usyskin * @pg_state: power gating state 54bb9f4d26SAlexander Usyskin * @d0i3_supported: di03 support 554ad96db6STomas Winkler */ 5652c34561STomas Winkler struct mei_me_hw { 574ad96db6STomas Winkler const struct mei_cfg *cfg; 5852c34561STomas Winkler void __iomem *mem_addr; 59ba9cdd0eSTomas Winkler enum mei_pg_state pg_state; 60bb9f4d26SAlexander Usyskin bool d0i3_supported; 6152c34561STomas Winkler }; 6266ef5ea9STomas Winkler 6352c34561STomas Winkler #define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw) 6452c34561STomas Winkler 65*f5ac3c49STomas Winkler /** 66*f5ac3c49STomas Winkler * enum mei_cfg_idx - indices to platform specific configurations. 67*f5ac3c49STomas Winkler * 68*f5ac3c49STomas Winkler * Note: has to be synchronized with mei_cfg_list[] 69*f5ac3c49STomas Winkler * 70*f5ac3c49STomas Winkler * @MEI_ME_UNDEF_CFG: Lower sentinel. 71*f5ac3c49STomas Winkler * @MEI_ME_ICH_CFG: I/O Controller Hub legacy devices. 72*f5ac3c49STomas Winkler * @MEI_ME_ICH10_CFG: I/O Controller Hub platforms Gen10 73*f5ac3c49STomas Winkler * @MEI_ME_PCH_CFG: Platform Controller Hub platforms (Up to Gen8). 74*f5ac3c49STomas Winkler * @MEI_ME_PCH_CPT_PBG_CFG:Platform Controller Hub workstations 75*f5ac3c49STomas Winkler * with quirk for Node Manager exclusion. 76*f5ac3c49STomas Winkler * @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer 77*f5ac3c49STomas Winkler * client platforms. 78*f5ac3c49STomas Winkler * @MEI_ME_PCH8_SPS_CFG: Platform Controller Hub Gen8 and newer 79*f5ac3c49STomas Winkler * servers platforms with quirk for 80*f5ac3c49STomas Winkler * SPS firmware exclusion. 81*f5ac3c49STomas Winkler * @MEI_ME_NUM_CFG: Upper Sentinel. 82*f5ac3c49STomas Winkler */ 83*f5ac3c49STomas Winkler enum mei_cfg_idx { 84*f5ac3c49STomas Winkler MEI_ME_UNDEF_CFG, 85*f5ac3c49STomas Winkler MEI_ME_ICH_CFG, 86*f5ac3c49STomas Winkler MEI_ME_ICH10_CFG, 87*f5ac3c49STomas Winkler MEI_ME_PCH_CFG, 88*f5ac3c49STomas Winkler MEI_ME_PCH_CPT_PBG_CFG, 89*f5ac3c49STomas Winkler MEI_ME_PCH8_CFG, 90*f5ac3c49STomas Winkler MEI_ME_PCH8_SPS_CFG, 91*f5ac3c49STomas Winkler MEI_ME_NUM_CFG, 92*f5ac3c49STomas Winkler }; 93*f5ac3c49STomas Winkler 94*f5ac3c49STomas Winkler const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx); 958d929d48SAlexander Usyskin 968d929d48SAlexander Usyskin struct mei_device *mei_me_dev_init(struct pci_dev *pdev, 978d929d48SAlexander Usyskin const struct mei_cfg *cfg); 9866ef5ea9STomas Winkler 992d1995fcSAlexander Usyskin int mei_me_pg_enter_sync(struct mei_device *dev); 1002d1995fcSAlexander Usyskin int mei_me_pg_exit_sync(struct mei_device *dev); 101ba9cdd0eSTomas Winkler 10206ecd645STomas Winkler irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id); 10306ecd645STomas Winkler irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id); 10406ecd645STomas Winkler 1059dc64d6aSTomas Winkler #endif /* _MEI_INTERFACE_H_ */ 106