| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <acpi/acpigen_pci.h> |
| 5 |
#include <intelblocks/acpi.h> |
| 6 |
#include <intelblocks/pcr.h> |
| 7 |
#include <intelblocks/itss.h> |
| 8 |
#include <soc/acpi.h> |
| 9 |
#include <soc/chip_common.h> |
| 10 |
#include <soc/numa.h> |
| 11 |
#include <soc/soc_util.h> |
| 12 |
#include <soc/util.h> |
| 13 |
#include <soc/pcr_ids.h> |
| 14 |
|
| 15 |
int soc_madt_sci_irq_polarity(int sci) |
| 16 |
{ |
| 17 |
int reg = sci / IRQS_PER_IPC; |
| 18 |
int offset = sci % IRQS_PER_IPC; |
| 19 |
uint32_t val = pcr_read32(PID_ITSS, PCR_ITSS_IPC0_CONF + reg * sizeof(uint32_t)); |
| 20 |
|
| 21 |
return (val & (1 << offset)) ? MP_IRQ_POLARITY_LOW : MP_IRQ_POLARITY_HIGH; |
| 22 |
} |
| 23 |
|
| 24 |
uint32_t soc_read_sci_irq_select(void) |
| 25 |
{ |
| 26 |
const uint16_t pmbase = ACPI_BASE_ADDRESS; |
| 27 |
return inl(pmbase + PMC_ACPI_CNT); |
| 28 |
} |
| 29 |
|
| 30 |
void soc_fill_fadt(acpi_fadt_t *fadt) |
| 31 |
{ |
| 32 |
const uint16_t pmbase = ACPI_BASE_ADDRESS; |
| 33 |
|
| 34 |
fadt->pm_tmr_blk = pmbase + PM1_TMR; |
| 35 |
fadt->pm_tmr_len = 4; |
| 36 |
fadt->flags &= ~(ACPI_FADT_SEALED_CASE | ACPI_FADT_S4_RTC_WAKE); |
| 37 |
fadt->preferred_pm_profile = PM_ENTERPRISE_SERVER; |
| 38 |
} |
| 39 |
|
| 40 |
void soc_power_states_generation(int core, int cores_per_package) |
| 41 |
{ |
| 42 |
generate_p_state_entries(core, cores_per_package); |
| 43 |
} |
| 44 |
|
| 45 |
static uint32_t get_granted_pcie_features(void) |
| 46 |
{ |
| 47 |
return PCIE_NATIVE_HOTPLUG_CONTROL | PCIE_PME_CONTROL | |
| 48 |
PCIE_CAP_STRUCTURE_CONTROL | PCIE_LTR_CONTROL | |
| 49 |
PCIE_AER_CONTROL; |
| 50 |
} |
| 51 |
|
| 52 |
static uint32_t get_granted_cxl_features(void) |
| 53 |
{ |
| 54 |
return CXL_ERROR_REPORTING_CONTROL; |
| 55 |
} |
| 56 |
|
| 57 |
void soc_pci_domain_fill_ssdt(const struct device *domain) |
| 58 |
{ |
| 59 |
const char *name = acpi_device_name(domain); |
| 60 |
if (!name) |
| 61 |
return; |
| 62 |
|
| 63 |
acpigen_write_scope(acpi_device_scope(domain)); |
| 64 |
acpigen_write_device(name); |
| 65 |
|
| 66 |
if (is_cxl_domain(domain)) { |
| 67 |
acpigen_write_name("_HID"); |
| 68 |
acpigen_emit_eisaid("ACPI0016"); |
| 69 |
acpigen_write_name("_CID"); |
| 70 |
acpigen_write_package(2); |
| 71 |
acpigen_emit_eisaid("PNP0A08"); |
| 72 |
acpigen_emit_eisaid("PNP0A03"); |
| 73 |
acpigen_pop_len(); |
| 74 |
} else { |
| 75 |
acpigen_write_name("_HID"); |
| 76 |
acpigen_emit_eisaid("PNP0A08"); |
| 77 |
acpigen_write_name("_CID"); |
| 78 |
acpigen_emit_eisaid("PNP0A03"); |
| 79 |
} |
| 80 |
acpigen_write_name("_UID"); |
| 81 |
acpigen_write_string(name); |
| 82 |
|
| 83 |
acpigen_write_name("_PXM"); |
| 84 |
acpigen_write_integer(device_to_pd(domain)); |
| 85 |
|
| 86 |
|
| 87 |
acpigen_write_PRT_pre_routed(domain); |
| 88 |
|
| 89 |
|
| 90 |
acpigen_write_OSC_pci_domain_fixed_caps(domain, |
| 91 |
get_granted_pcie_features(), |
| 92 |
is_cxl_domain(domain), |
| 93 |
get_granted_cxl_features() |
| 94 |
); |
| 95 |
|
| 96 |
acpigen_pop_len(); |
| 97 |
acpigen_pop_len(); |
| 98 |
} |