xref: /linux/drivers/platform/x86/amd/pmc/pmc.h (revision eb5e56d1491297e0881c95824e2050b7c205f0d4)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * AMD SoC Power Management Controller Driver
4  *
5  * Copyright (c) 2023, Advanced Micro Devices, Inc.
6  * All Rights Reserved.
7  *
8  * Author: Mario Limonciello <mario.limonciello@amd.com>
9  */
10 
11 #ifndef PMC_H
12 #define PMC_H
13 
14 #include <linux/types.h>
15 #include <linux/mutex.h>
16 
17 struct amd_mp2_dev {
18 	void __iomem *mmio;
19 	void __iomem *vslbase;
20 	void *stbdata;
21 	void *devres_gid;
22 	struct pci_dev *pdev;
23 	dma_addr_t dma_addr;
24 	int stb_len;
25 	bool is_stb_data;
26 };
27 
28 struct amd_pmc_dev {
29 	void __iomem *regbase;
30 	void __iomem *smu_virt_addr;
31 	void __iomem *stb_virt_addr;
32 	void __iomem *fch_virt_addr;
33 	bool msg_port;
34 	u32 base_addr;
35 	u32 cpu_id;
36 	u32 active_ips;
37 	u32 dram_size;
38 	u32 num_ips;
39 	u32 s2d_msg_id;
40 	u32 smu_msg;
41 /* SMU version information */
42 	u8 smu_program;
43 	u8 major;
44 	u8 minor;
45 	u8 rev;
46 	struct device *dev;
47 	struct pci_dev *rdev;
48 	struct mutex lock; /* generic mutex lock */
49 	struct dentry *dbgfs_dir;
50 	struct quirk_entry *quirks;
51 	bool disable_8042_wakeup;
52 	struct amd_mp2_dev *mp2;
53 };
54 
55 void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev);
56 void amd_pmc_quirks_init(struct amd_pmc_dev *dev);
57 void amd_mp2_stb_init(struct amd_pmc_dev *dev);
58 void amd_mp2_stb_deinit(struct amd_pmc_dev *dev);
59 
60 /* List of supported CPU ids */
61 #define AMD_CPU_ID_RV			0x15D0
62 #define AMD_CPU_ID_RN			0x1630
63 #define AMD_CPU_ID_PCO			AMD_CPU_ID_RV
64 #define AMD_CPU_ID_CZN			AMD_CPU_ID_RN
65 #define AMD_CPU_ID_YC			0x14B5
66 #define AMD_CPU_ID_CB			0x14D8
67 #define AMD_CPU_ID_PS			0x14E8
68 #define AMD_CPU_ID_SP			0x14A4
69 #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507
70 #define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122
71 #define PCI_DEVICE_ID_AMD_MP2_STB	0x172c
72 
73 #endif /* PMC_H */
74