xref: /linux/drivers/misc/mei/hw-me.h (revision bb9f4d26dda7d2a875cadc0f7eedee3d65d3d1f5)
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, \
444ad96db6STomas Winkler 	.driver_data = (kernel_ulong_t)&(cfg)
454ad96db6STomas Winkler 
464ad96db6STomas Winkler 
47180ea05bSTomas Winkler #define MEI_ME_RPM_TIMEOUT    500 /* ms */
48180ea05bSTomas Winkler 
494ad96db6STomas Winkler /**
50ce23139cSAlexander Usyskin  * struct mei_me_hw - me hw specific data
51ce23139cSAlexander Usyskin  *
524ad96db6STomas Winkler  * @cfg: per device generation config and ops
53ce23139cSAlexander Usyskin  * @mem_addr: io memory address
54ce23139cSAlexander Usyskin  * @pg_state: power gating state
55*bb9f4d26SAlexander Usyskin  * @d0i3_supported: di03 support
564ad96db6STomas Winkler  */
5752c34561STomas Winkler struct mei_me_hw {
584ad96db6STomas Winkler 	const struct mei_cfg *cfg;
5952c34561STomas Winkler 	void __iomem *mem_addr;
60ba9cdd0eSTomas Winkler 	enum mei_pg_state pg_state;
61*bb9f4d26SAlexander Usyskin 	bool d0i3_supported;
6252c34561STomas Winkler };
6366ef5ea9STomas Winkler 
6452c34561STomas Winkler #define to_me_hw(dev) (struct mei_me_hw *)((dev)->hw)
6552c34561STomas Winkler 
668d929d48SAlexander Usyskin extern const struct mei_cfg mei_me_legacy_cfg;
678d929d48SAlexander Usyskin extern const struct mei_cfg mei_me_ich_cfg;
688d929d48SAlexander Usyskin extern const struct mei_cfg mei_me_pch_cfg;
69c919951dSTomas Winkler extern const struct mei_cfg mei_me_pch_cpt_pbg_cfg;
70edca5ea3SAlexander Usyskin extern const struct mei_cfg mei_me_pch8_cfg;
71edca5ea3SAlexander Usyskin extern const struct mei_cfg mei_me_pch8_sps_cfg;
728d929d48SAlexander Usyskin 
738d929d48SAlexander Usyskin struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
748d929d48SAlexander Usyskin 				   const struct mei_cfg *cfg);
7566ef5ea9STomas Winkler 
762d1995fcSAlexander Usyskin int mei_me_pg_enter_sync(struct mei_device *dev);
772d1995fcSAlexander Usyskin int mei_me_pg_exit_sync(struct mei_device *dev);
78ba9cdd0eSTomas Winkler 
7906ecd645STomas Winkler irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id);
8006ecd645STomas Winkler irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id);
8106ecd645STomas Winkler 
829dc64d6aSTomas Winkler #endif /* _MEI_INTERFACE_H_ */
83