18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_INTEL_PUNIT_IPC_H_ 38c2ecf20Sopenharmony_ci#define _ASM_X86_INTEL_PUNIT_IPC_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Three types of 8bit P-Unit IPC commands are supported, 78c2ecf20Sopenharmony_ci * bit[7:6]: [00]: BIOS; [01]: GTD; [10]: ISPD. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_citypedef enum { 108c2ecf20Sopenharmony_ci BIOS_IPC = 0, 118c2ecf20Sopenharmony_ci GTDRIVER_IPC, 128c2ecf20Sopenharmony_ci ISPDRIVER_IPC, 138c2ecf20Sopenharmony_ci RESERVED_IPC, 148c2ecf20Sopenharmony_ci} IPC_TYPE; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define IPC_TYPE_OFFSET 6 178c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_CMD_BASE (BIOS_IPC << IPC_TYPE_OFFSET) 188c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_CMD_BASE (GTDDRIVER_IPC << IPC_TYPE_OFFSET) 198c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_CMD_BASE (ISPDRIVER_IPC << IPC_TYPE_OFFSET) 208c2ecf20Sopenharmony_ci#define IPC_PUNIT_CMD_TYPE_MASK (RESERVED_IPC << IPC_TYPE_OFFSET) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* BIOS => Pcode commands */ 238c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_ZERO (IPC_PUNIT_BIOS_CMD_BASE | 0x00) 248c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_VR_INTERFACE (IPC_PUNIT_BIOS_CMD_BASE | 0x01) 258c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_PCS (IPC_PUNIT_BIOS_CMD_BASE | 0x02) 268c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_PCS (IPC_PUNIT_BIOS_CMD_BASE | 0x03) 278c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_PCU_CONFIG (IPC_PUNIT_BIOS_CMD_BASE | 0x04) 288c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_PCU_CONFIG (IPC_PUNIT_BIOS_CMD_BASE | 0x05) 298c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_PL1_SETTING (IPC_PUNIT_BIOS_CMD_BASE | 0x06) 308c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_PL1_SETTING (IPC_PUNIT_BIOS_CMD_BASE | 0x07) 318c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_TRIGGER_VDD_RAM (IPC_PUNIT_BIOS_CMD_BASE | 0x08) 328c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_TELE_INFO (IPC_PUNIT_BIOS_CMD_BASE | 0x09) 338c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_TELE_TRACE_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x0a) 348c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_TELE_TRACE_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x0b) 358c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_TELE_EVENT_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x0c) 368c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_TELE_EVENT_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x0d) 378c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_TELE_TRACE (IPC_PUNIT_BIOS_CMD_BASE | 0x0e) 388c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_TELE_TRACE (IPC_PUNIT_BIOS_CMD_BASE | 0x0f) 398c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_TELE_EVENT (IPC_PUNIT_BIOS_CMD_BASE | 0x10) 408c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_TELE_EVENT (IPC_PUNIT_BIOS_CMD_BASE | 0x11) 418c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_MODULE_TEMP (IPC_PUNIT_BIOS_CMD_BASE | 0x12) 428c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_RESERVED (IPC_PUNIT_BIOS_CMD_BASE | 0x13) 438c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_VOLTAGE_OVER (IPC_PUNIT_BIOS_CMD_BASE | 0x14) 448c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_VOLTAGE_OVER (IPC_PUNIT_BIOS_CMD_BASE | 0x15) 458c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_RATIO_OVER (IPC_PUNIT_BIOS_CMD_BASE | 0x16) 468c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_RATIO_OVER (IPC_PUNIT_BIOS_CMD_BASE | 0x17) 478c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_VF_GL_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x18) 488c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_VF_GL_CTRL (IPC_PUNIT_BIOS_CMD_BASE | 0x19) 498c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_READ_FM_SOC_TEMP_THRESH (IPC_PUNIT_BIOS_CMD_BASE | 0x1a) 508c2ecf20Sopenharmony_ci#define IPC_PUNIT_BIOS_WRITE_FM_SOC_TEMP_THRESH (IPC_PUNIT_BIOS_CMD_BASE | 0x1b) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* GT Driver => Pcode commands */ 538c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_ZERO (IPC_PUNIT_GTD_CMD_BASE | 0x00) 548c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_CONFIG (IPC_PUNIT_GTD_CMD_BASE | 0x01) 558c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_READ_ICCP_LIC_CDYN_SCAL (IPC_PUNIT_GTD_CMD_BASE | 0x02) 568c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_WRITE_ICCP_LIC_CDYN_SCAL (IPC_PUNIT_GTD_CMD_BASE | 0x03) 578c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_GET_WM_VAL (IPC_PUNIT_GTD_CMD_BASE | 0x06) 588c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_WRITE_CONFIG_WISHREQ (IPC_PUNIT_GTD_CMD_BASE | 0x07) 598c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_READ_REQ_DUTY_CYCLE (IPC_PUNIT_GTD_CMD_BASE | 0x16) 608c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_DIS_VOL_FREQ_CHG_REQUEST (IPC_PUNIT_GTD_CMD_BASE | 0x17) 618c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_DYNA_DUTY_CYCLE_CTRL (IPC_PUNIT_GTD_CMD_BASE | 0x1a) 628c2ecf20Sopenharmony_ci#define IPC_PUNIT_GTD_DYNA_DUTY_CYCLE_TUNING (IPC_PUNIT_GTD_CMD_BASE | 0x1c) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* ISP Driver => Pcode commands */ 658c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_ZERO (IPC_PUNIT_ISPD_CMD_BASE | 0x00) 668c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_CONFIG (IPC_PUNIT_ISPD_CMD_BASE | 0x01) 678c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_GET_ISP_LTR_VAL (IPC_PUNIT_ISPD_CMD_BASE | 0x02) 688c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_ACCESS_IU_FREQ_BOUNDS (IPC_PUNIT_ISPD_CMD_BASE | 0x03) 698c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_READ_CDYN_LEVEL (IPC_PUNIT_ISPD_CMD_BASE | 0x04) 708c2ecf20Sopenharmony_ci#define IPC_PUNIT_ISPD_WRITE_CDYN_LEVEL (IPC_PUNIT_ISPD_CMD_BASE | 0x05) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Error codes */ 738c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_SUCCESS 0 748c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_INVALID_CMD 1 758c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_INVALID_PARAMETER 2 768c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_CMD_TIMEOUT 3 778c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_CMD_LOCKED 4 788c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_INVALID_VR_ID 5 798c2ecf20Sopenharmony_ci#define IPC_PUNIT_ERR_VR_ERR 6 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_INTEL_PUNIT_IPC) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciint intel_punit_ipc_simple_command(int cmd, int para1, int para2); 848c2ecf20Sopenharmony_ciint intel_punit_ipc_command(u32 cmd, u32 para1, u32 para2, u32 *in, u32 *out); 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#else 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic inline int intel_punit_ipc_simple_command(int cmd, 898c2ecf20Sopenharmony_ci int para1, int para2) 908c2ecf20Sopenharmony_ci{ 918c2ecf20Sopenharmony_ci return -ENODEV; 928c2ecf20Sopenharmony_ci} 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cistatic inline int intel_punit_ipc_command(u32 cmd, u32 para1, u32 para2, 958c2ecf20Sopenharmony_ci u32 *in, u32 *out) 968c2ecf20Sopenharmony_ci{ 978c2ecf20Sopenharmony_ci return -ENODEV; 988c2ecf20Sopenharmony_ci} 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#endif /* CONFIG_INTEL_PUNIT_IPC */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#endif 103