linux/drivers/hwmon/fam15h_power.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * fam15h_power.c - AMD Family 15h processor power monitoring
 *
 * Copyright (c) 2011-2016 Advanced Micro Devices, Inc.
 * Author: Andreas Herrmann <[email protected]>
 */

#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/bitops.h>
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/time.h>
#include <linux/sched.h>
#include <linux/topology.h>
#include <asm/processor.h>
#include <asm/msr.h>

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();

/* D18F3 */
#define REG_NORTHBRIDGE_CAP

/* D18F4 */
#define REG_PROCESSOR_TDP

/* D18F5 */
#define REG_TDP_RUNNING_AVERAGE
#define REG_TDP_LIMIT3

#define FAM15H_MIN_NUM_ATTRS
#define FAM15H_NUM_GROUPS
#define MAX_CUS

/* set maximum interval as 1 second */
#define MAX_INTERVAL

#define PCI_DEVICE_ID_AMD_15H_M70H_NB_F4

struct fam15h_power_data {};

static bool is_carrizo_or_later(void)
{}

static ssize_t power1_input_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(power1_input);

static ssize_t power1_crit_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(power1_crit);

static void do_read_registers_on_cu(void *_data)
{}

/*
 * This function is only able to be called when CPUID
 * Fn8000_0007:EDX[12] is set.
 */
static int read_registers(struct fam15h_power_data *data)
{}

static ssize_t power1_average_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(power1_average);

static ssize_t power1_average_interval_show(struct device *dev,
					    struct device_attribute *attr,
					    char *buf)
{}

static ssize_t power1_average_interval_store(struct device *dev,
					     struct device_attribute *attr,
					     const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(power1_average_interval);

static int fam15h_power_init_attrs(struct pci_dev *pdev,
				   struct fam15h_power_data *data)
{}

static bool should_load_on_this_node(struct pci_dev *f4)
{}

/*
 * Newer BKDG versions have an updated recommendation on how to properly
 * initialize the running average range (was: 0xE, now: 0x9). This avoids
 * counter saturations resulting in bogus power readings.
 * We correct this value ourselves to cope with older BIOSes.
 */
static const struct pci_device_id affected_device[] =;

static void tweak_runavg_range(struct pci_dev *pdev)
{}

#ifdef CONFIG_PM
static int fam15h_power_resume(struct pci_dev *pdev)
{}
#else
#define fam15h_power_resume
#endif

static int fam15h_power_init_data(struct pci_dev *f4,
				  struct fam15h_power_data *data)
{}

static int fam15h_power_probe(struct pci_dev *pdev,
			      const struct pci_device_id *id)
{}

static const struct pci_device_id fam15h_power_id_table[] =;
MODULE_DEVICE_TABLE(pci, fam15h_power_id_table);

static struct pci_driver fam15h_power_driver =;

module_pci_driver();