]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/amd/pmc: Update function names to align with new STB file
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Fri, 8 Nov 2024 07:08:15 +0000 (12:38 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 2 Dec 2024 17:31:41 +0000 (19:31 +0200)
With STB now in a separate file, update the function names to match the
correct naming schema by removing the _pmc_ prefix where needed.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-4-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmc/mp1_stb.c
drivers/platform/x86/amd/pmc/pmc.c
drivers/platform/x86/amd/pmc/pmc.h

index 29e0241190e4add610f937c0b92a3eaae3201119..5c03ac92558fe0f98712fe41a3fadd2fe97bc894 100644 (file)
@@ -24,7 +24,7 @@
 #define S2D_RSVD_RAM_SPACE             0x100000
 
 /* STB Registers */
-#define AMD_PMC_STB_PMI_0              0x03E30600
+#define AMD_STB_PMI_0                  0x03E30600
 #define AMD_PMC_STB_DUMMY_PC   0xC6000007
 
 /* STB Spill to DRAM Message Definition */
@@ -47,32 +47,32 @@ enum s2d_arg {
        S2D_DRAM_SIZE,
 };
 
-struct amd_pmc_stb_v2_data {
+struct amd_stb_v2_data {
        size_t size;
        u8 data[] __counted_by(size);
 };
 
-int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
+int amd_stb_write(struct amd_pmc_dev *dev, u32 data)
 {
        int err;
 
-       err = amd_smn_write(0, AMD_PMC_STB_PMI_0, data);
+       err = amd_smn_write(0, AMD_STB_PMI_0, data);
        if (err) {
-               dev_err(dev->dev, "failed to write data in stb: 0x%X\n", AMD_PMC_STB_PMI_0);
+               dev_err(dev->dev, "failed to write data in stb: 0x%X\n", AMD_STB_PMI_0);
                return pcibios_err_to_errno(err);
        }
 
        return 0;
 }
 
-int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
+int amd_stb_read(struct amd_pmc_dev *dev, u32 *buf)
 {
        int i, err;
 
        for (i = 0; i < FIFO_SIZE; i++) {
-               err = amd_smn_read(0, AMD_PMC_STB_PMI_0, buf++);
+               err = amd_smn_read(0, AMD_STB_PMI_0, buf++);
                if (err) {
-                       dev_err(dev->dev, "error reading data from stb: 0x%X\n", AMD_PMC_STB_PMI_0);
+                       dev_err(dev->dev, "error reading data from stb: 0x%X\n", AMD_STB_PMI_0);
                        return pcibios_err_to_errno(err);
                }
        }
@@ -80,7 +80,7 @@ int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
        return 0;
 }
 
-static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp)
+static int amd_stb_debugfs_open(struct inode *inode, struct file *filp)
 {
        struct amd_pmc_dev *dev = filp->f_inode->i_private;
        u32 size = FIFO_SIZE * sizeof(u32);
@@ -91,7 +91,7 @@ static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp)
        if (!buf)
                return -ENOMEM;
 
-       rc = amd_pmc_read_stb(dev, buf);
+       rc = amd_stb_read(dev, buf);
        if (rc) {
                kfree(buf);
                return rc;
@@ -101,8 +101,7 @@ static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp)
        return rc;
 }
 
-static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, size_t size,
-                                       loff_t *pos)
+static ssize_t amd_stb_debugfs_read(struct file *filp, char __user *buf, size_t size, loff_t *pos)
 {
        if (!filp->private_data)
                return -EINVAL;
@@ -111,24 +110,24 @@ static ssize_t amd_pmc_stb_debugfs_read(struct file *filp, char __user *buf, siz
                                       FIFO_SIZE * sizeof(u32));
 }
 
-static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp)
+static int amd_stb_debugfs_release(struct inode *inode, struct file *filp)
 {
        kfree(filp->private_data);
        return 0;
 }
 
-static const struct file_operations amd_pmc_stb_debugfs_fops = {
+static const struct file_operations amd_stb_debugfs_fops = {
        .owner = THIS_MODULE,
-       .open = amd_pmc_stb_debugfs_open,
-       .read = amd_pmc_stb_debugfs_read,
-       .release = amd_pmc_stb_debugfs_release,
+       .open = amd_stb_debugfs_open,
+       .read = amd_stb_debugfs_read,
+       .release = amd_stb_debugfs_release,
 };
 
 /* Enhanced STB Firmware Reporting Mechanism */
-static int amd_pmc_stb_handle_efr(struct file *filp)
+static int amd_stb_handle_efr(struct file *filp)
 {
        struct amd_pmc_dev *dev = filp->f_inode->i_private;
-       struct amd_pmc_stb_v2_data *stb_data_arr;
+       struct amd_stb_v2_data *stb_data_arr;
        u32 fsize;
 
        fsize = dev->dram_size - S2D_RSVD_RAM_SPACE;
@@ -143,15 +142,15 @@ static int amd_pmc_stb_handle_efr(struct file *filp)
        return 0;
 }
 
-static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
+static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
 {
        struct amd_pmc_dev *dev = filp->f_inode->i_private;
        u32 fsize, num_samples, val, stb_rdptr_offset = 0;
-       struct amd_pmc_stb_v2_data *stb_data_arr;
+       struct amd_stb_v2_data *stb_data_arr;
        int ret;
 
        /* Write dummy postcode while reading the STB buffer */
-       ret = amd_pmc_write_stb(dev, AMD_PMC_STB_DUMMY_PC);
+       ret = amd_stb_write(dev, AMD_PMC_STB_DUMMY_PC);
        if (ret)
                dev_err(dev->dev, "error writing to STB: %d\n", ret);
 
@@ -168,7 +167,7 @@ static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
         * platforms that support enhanced dram size reporting.
         */
        if (dump_custom_stb)
-               return amd_pmc_stb_handle_efr(filp);
+               return amd_stb_handle_efr(filp);
 
        /* Get the num_samples to calculate the last push location */
        ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true);
@@ -208,28 +207,28 @@ static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
        return 0;
 }
 
-static ssize_t amd_pmc_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size,
-                                          loff_t *pos)
+static ssize_t amd_stb_debugfs_read_v2(struct file *filp, char __user *buf, size_t size,
+                                      loff_t *pos)
 {
-       struct amd_pmc_stb_v2_data *data = filp->private_data;
+       struct amd_stb_v2_data *data = filp->private_data;
 
        return simple_read_from_buffer(buf, size, pos, data->data, data->size);
 }
 
-static int amd_pmc_stb_debugfs_release_v2(struct inode *inode, struct file *filp)
+static int amd_stb_debugfs_release_v2(struct inode *inode, struct file *filp)
 {
        kfree(filp->private_data);
        return 0;
 }
 
-static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = {
+static const struct file_operations amd_stb_debugfs_fops_v2 = {
        .owner = THIS_MODULE,
-       .open = amd_pmc_stb_debugfs_open_v2,
-       .read = amd_pmc_stb_debugfs_read_v2,
-       .release = amd_pmc_stb_debugfs_release_v2,
+       .open = amd_stb_debugfs_open_v2,
+       .read = amd_stb_debugfs_read_v2,
+       .release = amd_stb_debugfs_release_v2,
 };
 
-static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev)
+static bool amd_is_stb_supported(struct amd_pmc_dev *dev)
 {
        switch (dev->cpu_id) {
        case AMD_CPU_ID_YC:
@@ -248,7 +247,7 @@ static bool amd_pmc_is_stb_supported(struct amd_pmc_dev *dev)
        }
 }
 
-int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
+int amd_stb_s2d_init(struct amd_pmc_dev *dev)
 {
        u32 phys_addr_low, phys_addr_hi;
        u64 stb_phys_addr;
@@ -258,12 +257,12 @@ int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
        if (!enable_stb)
                return 0;
 
-       if (amd_pmc_is_stb_supported(dev)) {
+       if (amd_is_stb_supported(dev)) {
                debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev,
-                                   &amd_pmc_stb_debugfs_fops_v2);
+                                   &amd_stb_debugfs_fops_v2);
        } else {
                debugfs_create_file("stb_read", 0644, dev->dbgfs_dir, dev,
-                                   &amd_pmc_stb_debugfs_fops);
+                                   &amd_stb_debugfs_fops);
                return 0;
        }
 
index 79fecd6a62bbd5e2d7b575263f3b847e8a86399d..ddef24da9a66bd22fcb45d53b286ce395611ae8d 100644 (file)
@@ -671,7 +671,7 @@ static void amd_pmc_s2idle_prepare(void)
                return;
        }
 
-       rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_PREPARE);
+       rc = amd_stb_write(pdev, AMD_PMC_STB_S2IDLE_PREPARE);
        if (rc)
                dev_err(pdev->dev, "error writing to STB: %d\n", rc);
 }
@@ -690,7 +690,7 @@ static void amd_pmc_s2idle_check(void)
        /* Dump the IdleMask before we add to the STB */
        amd_pmc_idlemask_read(pdev, pdev->dev, NULL);
 
-       rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_CHECK);
+       rc = amd_stb_write(pdev, AMD_PMC_STB_S2IDLE_CHECK);
        if (rc)
                dev_err(pdev->dev, "error writing to STB: %d\n", rc);
 }
@@ -717,7 +717,7 @@ static void amd_pmc_s2idle_restore(void)
        /* Let SMU know that we are looking for stats */
        amd_pmc_dump_data(pdev);
 
-       rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_S2IDLE_RESTORE);
+       rc = amd_stb_write(pdev, AMD_PMC_STB_S2IDLE_RESTORE);
        if (rc)
                dev_err(pdev->dev, "error writing to STB: %d\n", rc);
 
@@ -832,7 +832,7 @@ static int amd_pmc_probe(struct platform_device *pdev)
        }
 
        amd_pmc_dbgfs_register(dev);
-       err = amd_pmc_s2d_init(dev);
+       err = amd_stb_s2d_init(dev);
        if (err)
                goto err_pci_dev_put;
 
index 8f939ab325105ecc554fd28a94fd39f0324d98d6..188284feca72c4dfff7c2ec4aaf54bb19d51d7e7 100644 (file)
@@ -70,9 +70,9 @@ void amd_mp2_stb_deinit(struct amd_pmc_dev *dev);
 #define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122
 #define PCI_DEVICE_ID_AMD_MP2_STB      0x172c
 
-int amd_pmc_s2d_init(struct amd_pmc_dev *dev);
-int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
-int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
+int amd_stb_s2d_init(struct amd_pmc_dev *dev);
+int amd_stb_read(struct amd_pmc_dev *dev, u32 *buf);
+int amd_stb_write(struct amd_pmc_dev *dev, u32 data);
 int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
 
 #endif /* PMC_H */