linux/drivers/platform/x86/amd/pmf/core.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * AMD Platform Management Framework Driver
 *
 * Copyright (c) 2022, Advanced Micro Devices, Inc.
 * All Rights Reserved.
 *
 * Author: Shyam Sundar S K <[email protected]>
 */

#include <asm/amd_nb.h>
#include <linux/debugfs.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include "pmf.h"

/* PMF-SMU communication registers */
#define AMD_PMF_REGISTER_MESSAGE
#define AMD_PMF_REGISTER_RESPONSE
#define AMD_PMF_REGISTER_ARGUMENT

/* Base address of SMU for mapping physical address to virtual address */
#define AMD_PMF_MAPPING_SIZE
#define AMD_PMF_BASE_ADDR_OFFSET
#define AMD_PMF_BASE_ADDR_LO
#define AMD_PMF_BASE_ADDR_HI
#define AMD_PMF_BASE_ADDR_LO_MASK
#define AMD_PMF_BASE_ADDR_HI_MASK

/* SMU Response Codes */
#define AMD_PMF_RESULT_OK
#define AMD_PMF_RESULT_CMD_REJECT_BUSY
#define AMD_PMF_RESULT_CMD_REJECT_PREREQ
#define AMD_PMF_RESULT_CMD_UNKNOWN
#define AMD_PMF_RESULT_FAILED

/* List of supported CPU ids */
#define AMD_CPU_ID_RMB
#define AMD_CPU_ID_PS
#define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT
#define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT

#define PMF_MSG_DELAY_MIN_US
#define RESPONSE_REGISTER_LOOP_MAX

#define DELAY_MIN_US
#define DELAY_MAX_US

/* override Metrics Table sample size time (in ms) */
static int metrics_table_loop_ms =;
module_param(metrics_table_loop_ms, int, 0644);
MODULE_PARM_DESC();

/* Force load on supported older platforms */
static bool force_load;
module_param(force_load, bool, 0444);
MODULE_PARM_DESC();

static int amd_pmf_pwr_src_notify_call(struct notifier_block *nb, unsigned long event, void *data)
{}

static int current_power_limits_show(struct seq_file *seq, void *unused)
{}
DEFINE_SHOW_ATTRIBUTE();

static void amd_pmf_dbgfs_unregister(struct amd_pmf_dev *dev)
{}

static void amd_pmf_dbgfs_register(struct amd_pmf_dev *dev)
{}

int amd_pmf_get_power_source(void)
{}

static void amd_pmf_get_metrics(struct work_struct *work)
{}

static inline u32 amd_pmf_reg_read(struct amd_pmf_dev *dev, int reg_offset)
{}

static inline void amd_pmf_reg_write(struct amd_pmf_dev *dev, int reg_offset, u32 val)
{}

static void __maybe_unused amd_pmf_dump_registers(struct amd_pmf_dev *dev)
{}

int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32 *data)
{}

static const struct pci_device_id pmf_pci_ids[] =;

int amd_pmf_set_dram_addr(struct amd_pmf_dev *dev, bool alloc_buffer)
{}

int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev)
{}

static int amd_pmf_suspend_handler(struct device *dev)
{}

static int amd_pmf_resume_handler(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(amd_pmf_pm, amd_pmf_suspend_handler, amd_pmf_resume_handler);

static void amd_pmf_init_features(struct amd_pmf_dev *dev)
{}

static void amd_pmf_deinit_features(struct amd_pmf_dev *dev)
{}

static const struct acpi_device_id amd_pmf_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, amd_pmf_acpi_ids);

static int amd_pmf_probe(struct platform_device *pdev)
{}

static void amd_pmf_remove(struct platform_device *pdev)
{}

static const struct attribute_group *amd_pmf_driver_groups[] =;

static struct platform_driver amd_pmf_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_SOFTDEP();