#include <linux/cpufeature.h>
#include <linux/cpuhotplug.h>
#include <linux/fs.h>
#include <linux/hashtable.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <uapi/linux/isst_if.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
#include "isst_if_common.h"
#define MSR_THREAD_ID_INFO …
#define MSR_PM_LOGICAL_ID …
#define MSR_CPU_BUS_NUMBER …
static struct isst_if_cmd_cb punit_callbacks[ISST_IF_DEV_MAX];
static int punit_msr_white_list[] = …;
struct isst_valid_cmd_ranges { … };
struct isst_cmd_set_req_type { … };
static const struct isst_valid_cmd_ranges isst_valid_cmds[] = …;
static const struct isst_cmd_set_req_type isst_cmd_set_reqs[] = …;
struct isst_cmd { … };
static bool isst_hpm_support;
static DECLARE_HASHTABLE(isst_hash, 8);
static DEFINE_MUTEX(isst_hash_lock);
static int isst_store_new_cmd(int cmd, u32 cpu, int mbox_cmd_type, u32 param,
u32 data)
{ … }
static void isst_delete_hash(void)
{ … }
int isst_store_cmd(int cmd, int sub_cmd, u32 cpu, int mbox_cmd_type,
u32 param, u64 data)
{ … }
EXPORT_SYMBOL_GPL(…);
static void isst_mbox_resume_command(struct isst_if_cmd_cb *cb,
struct isst_cmd *sst_cmd)
{ … }
void isst_resume_common(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void isst_restore_msr_local(int cpu)
{ … }
bool isst_if_mbox_cmd_invalid(struct isst_if_mbox_cmd *cmd)
{ … }
EXPORT_SYMBOL_GPL(…);
bool isst_if_mbox_cmd_set_req(struct isst_if_mbox_cmd *cmd)
{ … }
EXPORT_SYMBOL_GPL(…);
static int isst_if_api_version;
static int isst_if_get_platform_info(void __user *argp)
{ … }
#define ISST_MAX_BUS_NUMBER …
struct isst_if_cpu_info { … };
struct isst_if_pkg_info { … };
static struct isst_if_cpu_info *isst_cpu_info;
static struct isst_if_pkg_info *isst_pkg_info;
static struct pci_dev *_isst_if_get_pci_dev(int cpu, int bus_no, int dev, int fn)
{ … }
struct pci_dev *isst_if_get_pci_dev(int cpu, int bus_no, int dev, int fn)
{ … }
EXPORT_SYMBOL_GPL(…);
static int isst_if_cpu_online(unsigned int cpu)
{ … }
static int isst_if_online_id;
static int isst_if_cpu_info_init(void)
{ … }
static void isst_if_cpu_info_exit(void)
{
cpuhp_remove_state(isst_if_online_id);
kfree(isst_pkg_info);
kfree(isst_cpu_info);
};
static long isst_if_proc_phyid_req(u8 *cmd_ptr, int *write_only, int resume)
{ … }
static bool match_punit_msr_white_list(int msr)
{ … }
static long isst_if_msr_cmd_req(u8 *cmd_ptr, int *write_only, int resume)
{ … }
static long isst_if_exec_multi_cmd(void __user *argp, struct isst_if_cmd_cb *cb)
{ … }
static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static DEFINE_MUTEX(punit_misc_dev_open_lock);
static DEFINE_MUTEX(punit_misc_dev_reg_lock);
static int misc_usage_count;
static int misc_device_ret;
static int misc_device_open;
static int isst_if_open(struct inode *inode, struct file *file)
{ … }
static int isst_if_relase(struct inode *inode, struct file *f)
{ … }
static const struct file_operations isst_if_char_driver_ops = …;
static struct miscdevice isst_if_char_driver = …;
static int isst_misc_reg(void)
{ … }
static void isst_misc_unreg(void)
{ … }
int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
{ … }
EXPORT_SYMBOL_GPL(…);
void isst_if_cdev_unregister(int device_type)
{ … }
EXPORT_SYMBOL_GPL(…);
#define SST_HPM_SUPPORTED …
#define SST_MBOX_SUPPORTED …
static const struct x86_cpu_id isst_cpu_ids[] = …;
MODULE_DEVICE_TABLE(x86cpu, isst_cpu_ids);
static int __init isst_if_common_init(void)
{ … }
module_init(…) …
static void __exit isst_if_common_exit(void)
{ … }
module_exit(…)
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;