0001
0002
0003
0004
0005
0006
0007 #ifndef __PROCESSOR_THERMAL_DEVICE_H__
0008 #define __PROCESSOR_THERMAL_DEVICE_H__
0009
0010 #include <linux/intel_rapl.h>
0011
0012 #define PCI_DEVICE_ID_INTEL_ADL_THERMAL 0x461d
0013 #define PCI_DEVICE_ID_INTEL_BDW_THERMAL 0x1603
0014 #define PCI_DEVICE_ID_INTEL_BSW_THERMAL 0x22DC
0015
0016 #define PCI_DEVICE_ID_INTEL_BXT0_THERMAL 0x0A8C
0017 #define PCI_DEVICE_ID_INTEL_BXT1_THERMAL 0x1A8C
0018 #define PCI_DEVICE_ID_INTEL_BXTX_THERMAL 0x4A8C
0019 #define PCI_DEVICE_ID_INTEL_BXTP_THERMAL 0x5A8C
0020
0021 #define PCI_DEVICE_ID_INTEL_CNL_THERMAL 0x5a03
0022 #define PCI_DEVICE_ID_INTEL_CFL_THERMAL 0x3E83
0023 #define PCI_DEVICE_ID_INTEL_GLK_THERMAL 0x318C
0024 #define PCI_DEVICE_ID_INTEL_HSB_THERMAL 0x0A03
0025 #define PCI_DEVICE_ID_INTEL_ICL_THERMAL 0x8a03
0026 #define PCI_DEVICE_ID_INTEL_JSL_THERMAL 0x4E03
0027 #define PCI_DEVICE_ID_INTEL_MTLP_THERMAL 0x7D03
0028 #define PCI_DEVICE_ID_INTEL_RPL_THERMAL 0xA71D
0029 #define PCI_DEVICE_ID_INTEL_SKL_THERMAL 0x1903
0030 #define PCI_DEVICE_ID_INTEL_TGL_THERMAL 0x9A03
0031
0032 struct power_config {
0033 u32 index;
0034 u32 min_uw;
0035 u32 max_uw;
0036 u32 tmin_us;
0037 u32 tmax_us;
0038 u32 step_uw;
0039 };
0040
0041 struct proc_thermal_device {
0042 struct device *dev;
0043 struct acpi_device *adev;
0044 struct power_config power_limits[2];
0045 struct int34x_thermal_zone *int340x_zone;
0046 struct intel_soc_dts_sensors *soc_dts;
0047 u32 mmio_feature_mask;
0048 void __iomem *mmio_base;
0049 void *priv_data;
0050 };
0051
0052 struct rapl_mmio_regs {
0053 u64 reg_unit;
0054 u64 regs[RAPL_DOMAIN_MAX][RAPL_DOMAIN_REG_MAX];
0055 int limits[RAPL_DOMAIN_MAX];
0056 };
0057
0058 #define PROC_THERMAL_FEATURE_NONE 0x00
0059 #define PROC_THERMAL_FEATURE_RAPL 0x01
0060 #define PROC_THERMAL_FEATURE_FIVR 0x02
0061 #define PROC_THERMAL_FEATURE_DVFS 0x04
0062 #define PROC_THERMAL_FEATURE_MBOX 0x08
0063
0064 #if IS_ENABLED(CONFIG_PROC_THERMAL_MMIO_RAPL)
0065 int proc_thermal_rapl_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
0066 void proc_thermal_rapl_remove(void);
0067 #else
0068 static int __maybe_unused proc_thermal_rapl_add(struct pci_dev *pdev,
0069 struct proc_thermal_device *proc_priv)
0070 {
0071 return 0;
0072 }
0073
0074 static void __maybe_unused proc_thermal_rapl_remove(void)
0075 {
0076 }
0077 #endif
0078
0079 int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
0080 void proc_thermal_rfim_remove(struct pci_dev *pdev);
0081
0082 int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
0083 void proc_thermal_mbox_remove(struct pci_dev *pdev);
0084
0085 int processor_thermal_send_mbox_read_cmd(struct pci_dev *pdev, u16 id, u64 *resp);
0086 int processor_thermal_send_mbox_write_cmd(struct pci_dev *pdev, u16 id, u32 data);
0087 int proc_thermal_add(struct device *dev, struct proc_thermal_device *priv);
0088 void proc_thermal_remove(struct proc_thermal_device *proc_priv);
0089 int proc_thermal_suspend(struct device *dev);
0090 int proc_thermal_resume(struct device *dev);
0091 int proc_thermal_mmio_add(struct pci_dev *pdev,
0092 struct proc_thermal_device *proc_priv,
0093 kernel_ulong_t feature_mask);
0094 void proc_thermal_mmio_remove(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
0095 #endif