mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
platform/x86/amd/pmf: Force load driver on older supported platforms
Some of the older platforms with _HID "AMDI0100" PMF driver can be force loaded by interested users but only for experimental purposes. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20220802151149.2123699-11-Shyam-sundar.S-k@amd.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
7d77dcc83a
commit
9448ec9b0f
|
|
@ -39,6 +39,7 @@
|
|||
#define AMD_PMF_RESULT_FAILED 0xFF
|
||||
|
||||
/* List of supported CPU ids */
|
||||
#define AMD_CPU_ID_RMB 0x14b5
|
||||
#define AMD_CPU_ID_PS 0x14e8
|
||||
|
||||
#define PMF_MSG_DELAY_MIN_US 50
|
||||
|
|
@ -52,6 +53,11 @@ static int metrics_table_loop_ms = 1000;
|
|||
module_param(metrics_table_loop_ms, int, 0644);
|
||||
MODULE_PARM_DESC(metrics_table_loop_ms, "Metrics Table sample size time (default = 1000ms)");
|
||||
|
||||
/* Force load on supported older platforms */
|
||||
static bool force_load;
|
||||
module_param(force_load, bool, 0444);
|
||||
MODULE_PARM_DESC(force_load, "Force load this driver on supported older platforms (experimental)");
|
||||
|
||||
static int current_power_limits_show(struct seq_file *seq, void *unused)
|
||||
{
|
||||
struct amd_pmf_dev *dev = seq->private;
|
||||
|
|
@ -208,6 +214,7 @@ int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32
|
|||
}
|
||||
|
||||
static const struct pci_device_id pmf_pci_ids[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_RMB) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PS) },
|
||||
{ }
|
||||
};
|
||||
|
|
@ -265,6 +272,7 @@ static void amd_pmf_deinit_features(struct amd_pmf_dev *dev)
|
|||
}
|
||||
|
||||
static const struct acpi_device_id amd_pmf_acpi_ids[] = {
|
||||
{"AMDI0100", 0x100},
|
||||
{"AMDI0102", 0},
|
||||
{ }
|
||||
};
|
||||
|
|
@ -272,6 +280,7 @@ MODULE_DEVICE_TABLE(acpi, amd_pmf_acpi_ids);
|
|||
|
||||
static int amd_pmf_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct acpi_device_id *id;
|
||||
struct amd_pmf_dev *dev;
|
||||
struct pci_dev *rdev;
|
||||
u32 base_addr_lo;
|
||||
|
|
@ -280,6 +289,13 @@ static int amd_pmf_probe(struct platform_device *pdev)
|
|||
u32 val;
|
||||
int err;
|
||||
|
||||
id = acpi_match_device(amd_pmf_acpi_ids, &pdev->dev);
|
||||
if (!id)
|
||||
return -ENODEV;
|
||||
|
||||
if (id->driver_data == 0x100 && !force_load)
|
||||
return -ENODEV;
|
||||
|
||||
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user