1320Ssundar/* SPDX-License-Identifier: MIT */
2320Ssundar/*
3320Ssundar * Copyright �� 2022 Intel Corporation
4877Sattila */
5320Ssundar
6320Ssundar/* Internal to xe_pcode */
7320Ssundar
8877Sattila#include "regs/xe_reg_defs.h"
9320Ssundar
10320Ssundar#define PCODE_MAILBOX			XE_REG(0x138124)
11320Ssundar#define   PCODE_READY			REG_BIT(31)
12320Ssundar#define   PCODE_MB_PARAM2		REG_GENMASK(23, 16)
13320Ssundar#define   PCODE_MB_PARAM1		REG_GENMASK(15, 8)
14877Sattila#define   PCODE_MB_COMMAND		REG_GENMASK(7, 0)
15320Ssundar#define   PCODE_ERROR_MASK		0xFF
16320Ssundar#define     PCODE_SUCCESS		0x0
17320Ssundar#define     PCODE_ILLEGAL_CMD		0x1
18877Sattila#define     PCODE_TIMEOUT		0x2
19320Ssundar#define     PCODE_ILLEGAL_DATA		0x3
20320Ssundar#define     PCODE_ILLEGAL_SUBCOMMAND	0x4
21320Ssundar#define     PCODE_LOCKED		0x6
22320Ssundar#define     PCODE_GT_RATIO_OUT_OF_RANGE	0x10
23320Ssundar#define     PCODE_REJECTED		0x11
24320Ssundar
25320Ssundar#define PCODE_DATA0			XE_REG(0x138128)
26320Ssundar#define PCODE_DATA1			XE_REG(0x13812C)
27320Ssundar
28320Ssundar/* Min Freq QOS Table */
29320Ssundar#define   PCODE_WRITE_MIN_FREQ_TABLE	0x8
30320Ssundar#define   PCODE_READ_MIN_FREQ_TABLE	0x9
31320Ssundar#define   PCODE_FREQ_RING_RATIO_SHIFT	16
32320Ssundar
33320Ssundar/* PCODE Init */
34320Ssundar#define   DGFX_PCODE_STATUS		0x7E
35320Ssundar#define     DGFX_GET_INIT_STATUS	0x0
36320Ssundar#define     DGFX_INIT_STATUS_COMPLETE	0x1
37320Ssundar
38320Ssundar#define   PCODE_POWER_SETUP			0x7C
39320Ssundar#define     POWER_SETUP_SUBCOMMAND_READ_I1	0x4
40320Ssundar#define     POWER_SETUP_SUBCOMMAND_WRITE_I1	0x5
41320Ssundar#define	    POWER_SETUP_I1_WATTS		REG_BIT(31)
42320Ssundar#define	    POWER_SETUP_I1_SHIFT		6	/* 10.6 fixed point format */
43320Ssundar#define	    POWER_SETUP_I1_DATA_MASK		REG_GENMASK(15, 0)
44320Ssundar
45320Ssundar#define   PCODE_FREQUENCY_CONFIG		0x6e
46320Ssundar/* Frequency Config Sub Commands (param1) */
47320Ssundar#define     PCODE_MBOX_FC_SC_READ_FUSED_P0	0x0
48320Ssundar#define     PCODE_MBOX_FC_SC_READ_FUSED_PN	0x1
49320Ssundar/* Domain IDs (param2) */
50320Ssundar#define     PCODE_MBOX_DOMAIN_HBM		0x2
51320Ssundar
52320Ssundarstruct pcode_err_decode {
53320Ssundar	int errno;
54320Ssundar	const char *str;
55320Ssundar};
56320Ssundar
57