| 1 |
|
| 2 |
|
| 3 |
#ifndef SOC_INTEL_COMMON_BLOCK_ACPI_H |
| 4 |
#define SOC_INTEL_COMMON_BLOCK_ACPI_H |
| 5 |
|
| 6 |
#include <acpi/acpi.h> |
| 7 |
#include <device/device.h> |
| 8 |
#include <intelblocks/cpulib.h> |
| 9 |
#include <soc/pm.h> |
| 10 |
#include <stdint.h> |
| 11 |
|
| 12 |
|
| 13 |
enum core_type { |
| 14 |
CPUID_RESERVED_1 = 0x10, |
| 15 |
CPUID_CORE_TYPE_INTEL_ATOM = 0x20, |
| 16 |
CPUID_RESERVED_2 = 0x30, |
| 17 |
CPUID_CORE_TYPE_INTEL_CORE = 0x40, |
| 18 |
CPUID_UNKNOWN = 0xff, |
| 19 |
}; |
| 20 |
|
| 21 |
|
| 22 |
enum cpu_perf_eff_type { |
| 23 |
CPU_TYPE_EFF, |
| 24 |
CPU_TYPE_PERF, |
| 25 |
}; |
| 26 |
|
| 27 |
unsigned long acpi_create_madt_lapics_with_nmis_hybrid(unsigned long current); |
| 28 |
|
| 29 |
#if CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#if CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS) |
| 36 |
enum cb_err soc_read_core_scaling_factors(u16 *performance, u16 *efficient); |
| 37 |
#else |
| 38 |
static inline enum cb_err soc_read_core_scaling_factors(u16 *performance, u16 *efficient) |
| 39 |
{ |
| 40 |
_Static_assert(CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR != 0, |
| 41 |
"CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR must not be zero"); |
| 42 |
|
| 43 |
_Static_assert(CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR != 0, |
| 44 |
"CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR must not be zero"); |
| 45 |
|
| 46 |
*performance = CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR; |
| 47 |
*efficient = CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR; |
| 48 |
|
| 49 |
return CB_SUCCESS; |
| 50 |
} |
| 51 |
#endif |
| 52 |
#endif |
| 53 |
|
| 54 |
|
| 55 |
void acpigen_write_CPPC_hybrid_method(int core_id); |
| 56 |
|
| 57 |
|
| 58 |
struct chipset_power_state; |
| 59 |
|
| 60 |
|
| 61 |
struct global_nvs; |
| 62 |
|
| 63 |
|
| 64 |
const char *soc_acpi_name(const struct device *dev); |
| 65 |
|
| 66 |
|
| 67 |
uint32_t soc_read_sci_irq_select(void); |
| 68 |
|
| 69 |
|
| 70 |
void soc_write_sci_irq_select(uint32_t scis); |
| 71 |
|
| 72 |
|
| 73 |
#define MWAIT_RES(state, sub_state) \ |
| 74 |
{ \ |
| 75 |
.addrl = (((state) << 4) | (sub_state)), \ |
| 76 |
.space_id = ACPI_ADDRESS_SPACE_FIXED, \ |
| 77 |
.bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, \ |
| 78 |
.bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, \ |
| 79 |
.access_size = ACPI_FFIXEDHW_FLAG_HW_COORD, \ |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
const acpi_cstate_t *soc_get_cstate_map(size_t *num_entries); |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
acpi_tstate_t *soc_get_tss_table(int *entries); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
void acpi_fill_soc_wake(uint32_t *pm1_en, uint32_t *gpe0_en, |
| 98 |
const struct chipset_power_state *ps); |
| 99 |
|
| 100 |
|
| 101 |
unsigned long sa_write_acpi_tables(const struct device *dev, |
| 102 |
unsigned long current, |
| 103 |
struct acpi_rsdp *rsdp); |
| 104 |
|
| 105 |
|
| 106 |
int soc_madt_sci_irq_polarity(int sci); |
| 107 |
|
| 108 |
|
| 109 |
void generate_p_state_entries(int core, int cores_per_package); |
| 110 |
|
| 111 |
|
| 112 |
void generate_t_state_entries(int core, int cores_per_package); |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
void soc_power_states_generation(int core_id, int cores_per_package); |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
int common_calculate_power_ratio(int tdp, int p1_ratio, int ratio); |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
size_t soc_get_ioapic_info(const uintptr_t *ioapic_bases[]); |
| 131 |
|
| 132 |
struct soc_pmc_lpm { |
| 133 |
unsigned int num_substates; |
| 134 |
unsigned int num_req_regs; |
| 135 |
unsigned int lpm_ipc_offset; |
| 136 |
unsigned int req_reg_stride; |
| 137 |
uint8_t lpm_enable_mask; |
| 138 |
}; |
| 139 |
|
| 140 |
|
| 141 |
void generate_acpi_power_engine(void); |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
void generate_acpi_power_engine_with_lpm(const struct soc_pmc_lpm *lpm); |
| 146 |
|
| 147 |
|
| 148 |
void sgx_fill_ssdt(void); |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
enum core_type get_soc_cpu_type(void); |
| 157 |
|
| 158 |
|
| 159 |
bool soc_is_nominal_freq_supported(void); |
| 160 |
|
| 161 |
|
| 162 |
struct min_sleep_state { |
| 163 |
uint8_t pci_dev; |
| 164 |
enum acpi_device_sleep_states min_sleep_state; |
| 165 |
}; |
| 166 |
|
| 167 |
|
| 168 |
void set_dev_core_type(void); |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
struct min_sleep_state *soc_get_min_sleep_state_array(size_t *size); |
| 189 |
|
| 190 |
#endif |