linux/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * uncore-frquency-tpmi: Uncore frequency scaling using TPMI
 *
 * Copyright (c) 2023, Intel Corporation.
 * All Rights Reserved.
 *
 * The hardware interface to read/write is basically substitution of
 * MSR 0x620 and 0x621.
 * There are specific MMIO offset and bits to get/set minimum and
 * maximum uncore ratio, similar to MSRs.
 * The scope of the uncore MSRs was package scope. But TPMI allows
 * new gen CPUs to have multiple uncore controls at uncore-cluster
 * level. Each package can have multiple power domains which further
 * can have multiple clusters.
 * Here number of power domains = number of resources in this aux
 * device. There are offsets and bits to discover number of clusters
 * and offset for each cluster level controls.
 *
 */

#include <linux/auxiliary_bus.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/intel_tpmi.h>

#include "uncore-frequency-common.h"

#define UNCORE_MAJOR_VERSION
#define UNCORE_MINOR_VERSION
#define UNCORE_HEADER_INDEX
#define UNCORE_FABRIC_CLUSTER_OFFSET

/* status + control + adv_ctl1 + adv_ctl2 */
#define UNCORE_FABRIC_CLUSTER_SIZE

#define UNCORE_STATUS_INDEX
#define UNCORE_CONTROL_INDEX

#define UNCORE_FREQ_KHZ_MULTIPLIER

struct tpmi_uncore_struct;

/* Information for each cluster */
struct tpmi_uncore_cluster_info {};

/* Information for each power domain */
struct tpmi_uncore_power_domain_info {};

/* Information for all power domains in a package */
struct tpmi_uncore_struct {};

/* Bit definitions for STATUS register */
#define UNCORE_CURRENT_RATIO_MASK

/* Bit definitions for CONTROL register */
#define UNCORE_MAX_RATIO_MASK
#define UNCORE_MIN_RATIO_MASK

/* Helper function to read MMIO offset for max/min control frequency */
static void read_control_freq(struct tpmi_uncore_cluster_info *cluster_info,
			     unsigned int *value, enum uncore_index index)
{}

#define UNCORE_MAX_RATIO

/* Helper for sysfs read for max/min frequencies. Called under mutex locks */
static int uncore_read_control_freq(struct uncore_data *data, unsigned int *value,
				    enum uncore_index index)
{}

/* Helper function to write MMIO offset for max/min control frequency */
static void write_control_freq(struct tpmi_uncore_cluster_info *cluster_info, unsigned int input,
			      unsigned int index)
{}

/* Callback for sysfs write for max/min frequencies. Called under mutex locks */
static int uncore_write_control_freq(struct uncore_data *data, unsigned int input,
				     enum uncore_index index)
{}

/* Helper for sysfs read for the current uncore frequency. Called under mutex locks */
static int uncore_read_freq(struct uncore_data *data, unsigned int *freq)
{}

/* Callback for sysfs read for TPMI uncore values. Called under mutex locks. */
static int uncore_read(struct uncore_data *data, unsigned int *value, enum uncore_index index)
{}

static void remove_cluster_entries(struct tpmi_uncore_struct *tpmi_uncore)
{}

#define UNCORE_VERSION_MASK
#define UNCORE_LOCAL_FABRIC_CLUSTER_ID_MASK
#define UNCORE_CLUSTER_OFF_MASK
#define UNCORE_MAX_CLUSTER_PER_DOMAIN

static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id)
{}

static void uncore_remove(struct auxiliary_device *auxdev)
{}

static const struct auxiliary_device_id intel_uncore_id_table[] =;
MODULE_DEVICE_TABLE(auxiliary, intel_uncore_id_table);

static struct auxiliary_driver intel_uncore_aux_driver =;

module_auxiliary_driver();

MODULE_IMPORT_NS();
MODULE_IMPORT_NS();
MODULE_DESCRIPTION();
MODULE_LICENSE();