1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <acpi/acpigen.h>
5 #include <intelblocks/acpi.h>
6 #include <soc/chip_common.h>
7 #include <soc/pci_devs.h>
16 * List of supported C-states in this processor.
26 static const acpi_cstate_t cstate_map
[NUM_C_STATES
] = {
31 .resource
= MWAIT_RES(0, 0),
37 .resource
= MWAIT_RES(1, 0),
43 .resource
= MWAIT_RES(2, 0),
49 .resource
= MWAIT_RES(3, 0),
53 /* Max states supported */
54 static int cstate_set_all
[] = {
61 static int cstate_set_c1_c6
[] = {
66 const acpi_cstate_t
*soc_get_cstate_map(size_t *entries
)
68 static acpi_cstate_t map
[ARRAY_SIZE(cstate_set_all
)];
72 const config_t
*config
= config_of_soc();
74 const enum acpi_cstate_mode states
= config
->cstate_states
;
78 *entries
= ARRAY_SIZE(cstate_set_c1_c6
);
79 cstate_set
= cstate_set_c1_c6
;
83 *entries
= ARRAY_SIZE(cstate_set_all
);
84 cstate_set
= cstate_set_all
;
88 for (i
= 0; i
< *entries
; i
++) {
89 map
[i
] = cstate_map
[cstate_set
[i
]];
95 void iio_domain_set_acpi_name(struct device
*dev
, const char *prefix
)
97 const union xeon_domain_path dn
= {
98 .domain_path
= dev
->path
.domain
.domain
101 assert(dn
.socket
< CONFIG_MAX_SOCKET
);
102 assert(dn
.stack
< 16);
103 assert(prefix
!= NULL
&& strlen(prefix
) == 2);
105 if (dn
.socket
>= CONFIG_MAX_SOCKET
|| dn
.stack
>= 16 ||
106 !prefix
|| strlen(prefix
) != 2)
109 char *name
= xmalloc(ACPI_NAME_BUFFER_SIZE
);
110 snprintf(name
, ACPI_NAME_BUFFER_SIZE
, "%s%1X%1X", prefix
, dn
.socket
, dn
.stack
);
114 const char *soc_acpi_name(const struct device
*dev
)
116 if (dev
->path
.type
== DEVICE_PATH_DOMAIN
)
119 /* FIXME: Add SoC specific device names here */
124 void acpigen_write_OSC_pci_domain_fixed_caps(const struct device
*domain
,
125 const uint32_t granted_pcie_features
,
126 const bool is_cxl_domain
,
127 const uint32_t granted_cxl_features
)
129 acpigen_write_method("_OSC", 4);
131 acpigen_write_return_namestr("\\_SB.POSC");
132 acpigen_emit_byte(ARG0_OP
);
133 acpigen_emit_byte(ARG1_OP
);
134 acpigen_emit_byte(ARG2_OP
);
135 acpigen_emit_byte(ARG3_OP
);
136 acpigen_write_integer(granted_pcie_features
);
137 acpigen_write_integer(is_cxl_domain
);
138 acpigen_write_integer(granted_cxl_features
);