Angel Pons | 3bd1e3d | 2020-04-05 15:47:17 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Kyösti Mälkki | 0c1dd9c | 2020-06-17 23:37:49 +0300 | [diff] [blame] | 4 | #include <acpi/acpi_gnvs.h> |
Kyösti Mälkki | 2787237 | 2021-01-21 16:05:26 +0200 | [diff] [blame] | 5 | #include <acpi/acpi_pm.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 6 | #include <acpi/acpigen.h> |
robbie zhang | b45dde0 | 2015-10-01 17:21:33 -0700 | [diff] [blame] | 7 | #include <arch/cpu.h> |
Duncan Laurie | db54a67 | 2015-09-04 14:19:35 -0700 | [diff] [blame] | 8 | #include <arch/ioapic.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 9 | #include <arch/smp/mpspec.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 10 | #include <console/console.h> |
Matt Delco | 9084c3c | 2018-07-27 14:17:29 -0700 | [diff] [blame] | 11 | #include <cpu/intel/common/common.h> |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 12 | #include <intelblocks/acpi.h> |
Kyösti Mälkki | ca71e13 | 2021-01-15 05:06:35 +0200 | [diff] [blame] | 13 | #include <intelblocks/acpi_wake_source.h> |
Barnali Sarkar | 0a203d1 | 2017-05-04 18:02:17 +0530 | [diff] [blame] | 14 | #include <intelblocks/cpulib.h> |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 15 | #include <intelblocks/pmclib.h> |
Pratik Prajapati | 418535e | 2017-10-11 16:12:21 -0700 | [diff] [blame] | 16 | #include <intelblocks/sgx.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 17 | #include <soc/cpu.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 18 | #include <soc/msr.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 19 | #include <soc/pm.h> |
Naresh G Solanki | a2d4062 | 2016-08-30 20:47:13 +0530 | [diff] [blame] | 20 | #include <soc/ramstage.h> |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 21 | #include <soc/systemagent.h> |
robbie zhang | b45dde0 | 2015-10-01 17:21:33 -0700 | [diff] [blame] | 22 | #include <string.h> |
| 23 | #include <types.h> |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 24 | |
Elyes HAOUAS | c338507 | 2019-03-21 15:38:06 +0100 | [diff] [blame] | 25 | #include "chip.h" |
| 26 | |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 27 | /* |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 28 | * List of supported C-states in this processor. |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 29 | */ |
| 30 | enum { |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 31 | C_STATE_C0, /* 0 */ |
| 32 | C_STATE_C1, /* 1 */ |
| 33 | C_STATE_C1E, /* 2 */ |
| 34 | C_STATE_C3, /* 3 */ |
| 35 | C_STATE_C6_SHORT_LAT, /* 4 */ |
| 36 | C_STATE_C6_LONG_LAT, /* 5 */ |
| 37 | C_STATE_C7_SHORT_LAT, /* 6 */ |
| 38 | C_STATE_C7_LONG_LAT, /* 7 */ |
| 39 | C_STATE_C7S_SHORT_LAT, /* 8 */ |
| 40 | C_STATE_C7S_LONG_LAT, /* 9 */ |
| 41 | C_STATE_C8, /* 10 */ |
| 42 | C_STATE_C9, /* 11 */ |
| 43 | C_STATE_C10, /* 12 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 44 | NUM_C_STATES |
| 45 | }; |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 46 | #define MWAIT_RES(state, sub_state) \ |
| 47 | { \ |
| 48 | .addrl = (((state) << 4) | (sub_state)), \ |
| 49 | .space_id = ACPI_ADDRESS_SPACE_FIXED, \ |
| 50 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, \ |
| 51 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, \ |
| 52 | .access_size = ACPI_FFIXEDHW_FLAG_HW_COORD, \ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | static acpi_cstate_t cstate_map[NUM_C_STATES] = { |
| 56 | [C_STATE_C0] = { }, |
| 57 | [C_STATE_C1] = { |
| 58 | .latency = 0, |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 59 | .power = C1_POWER, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 60 | .resource = MWAIT_RES(0, 0), |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 61 | }, |
| 62 | [C_STATE_C1E] = { |
| 63 | .latency = 0, |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 64 | .power = C1_POWER, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 65 | .resource = MWAIT_RES(0, 1), |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 66 | }, |
| 67 | [C_STATE_C3] = { |
| 68 | .latency = C_STATE_LATENCY_FROM_LAT_REG(0), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 69 | .power = C3_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 70 | .resource = MWAIT_RES(1, 0), |
| 71 | }, |
| 72 | [C_STATE_C6_SHORT_LAT] = { |
| 73 | .latency = C_STATE_LATENCY_FROM_LAT_REG(1), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 74 | .power = C6_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 75 | .resource = MWAIT_RES(2, 0), |
| 76 | }, |
| 77 | [C_STATE_C6_LONG_LAT] = { |
| 78 | .latency = C_STATE_LATENCY_FROM_LAT_REG(2), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 79 | .power = C6_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 80 | .resource = MWAIT_RES(2, 1), |
| 81 | }, |
| 82 | [C_STATE_C7_SHORT_LAT] = { |
| 83 | .latency = C_STATE_LATENCY_FROM_LAT_REG(1), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 84 | .power = C7_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 85 | .resource = MWAIT_RES(3, 0), |
| 86 | }, |
| 87 | [C_STATE_C7_LONG_LAT] = { |
| 88 | .latency = C_STATE_LATENCY_FROM_LAT_REG(2), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 89 | .power = C7_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 90 | .resource = MWAIT_RES(3, 1), |
| 91 | }, |
| 92 | [C_STATE_C7S_SHORT_LAT] = { |
| 93 | .latency = C_STATE_LATENCY_FROM_LAT_REG(1), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 94 | .power = C7_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 95 | .resource = MWAIT_RES(3, 2), |
| 96 | }, |
| 97 | [C_STATE_C7S_LONG_LAT] = { |
| 98 | .latency = C_STATE_LATENCY_FROM_LAT_REG(2), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 99 | .power = C7_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 100 | .resource = MWAIT_RES(3, 3), |
| 101 | }, |
| 102 | [C_STATE_C8] = { |
| 103 | .latency = C_STATE_LATENCY_FROM_LAT_REG(3), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 104 | .power = C8_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 105 | .resource = MWAIT_RES(4, 0), |
| 106 | }, |
| 107 | [C_STATE_C9] = { |
| 108 | .latency = C_STATE_LATENCY_FROM_LAT_REG(4), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 109 | .power = C9_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 110 | .resource = MWAIT_RES(5, 0), |
| 111 | }, |
| 112 | [C_STATE_C10] = { |
| 113 | .latency = C_STATE_LATENCY_FROM_LAT_REG(5), |
robbie zhang | c16b1fd | 2015-09-11 14:25:15 -0700 | [diff] [blame] | 114 | .power = C10_POWER, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 115 | .resource = MWAIT_RES(6, 0), |
| 116 | }, |
| 117 | }; |
| 118 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 119 | static int cstate_set_s0ix[] = { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 120 | C_STATE_C1E, |
| 121 | C_STATE_C7S_LONG_LAT, |
| 122 | C_STATE_C10 |
| 123 | }; |
| 124 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 125 | static int cstate_set_non_s0ix[] = { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 126 | C_STATE_C1E, |
| 127 | C_STATE_C3, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 128 | C_STATE_C7S_LONG_LAT, |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 129 | }; |
| 130 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 131 | acpi_cstate_t *soc_get_cstate_map(size_t *entries) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 132 | { |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 133 | static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), |
| 134 | ARRAY_SIZE(cstate_set_non_s0ix))]; |
| 135 | int *set; |
| 136 | int i; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 137 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 138 | config_t *config = config_of_soc(); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 139 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 140 | int is_s0ix_enable = config->s0ix_enable; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 141 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 142 | if (is_s0ix_enable) { |
| 143 | *entries = ARRAY_SIZE(cstate_set_s0ix); |
| 144 | set = cstate_set_s0ix; |
| 145 | } else { |
| 146 | *entries = ARRAY_SIZE(cstate_set_non_s0ix); |
| 147 | set = cstate_set_non_s0ix; |
| 148 | } |
| 149 | |
| 150 | for (i = 0; i < *entries; i++) { |
| 151 | memcpy(&map[i], &cstate_map[set[i]], sizeof(acpi_cstate_t)); |
| 152 | map[i].ctype = i + 1; |
| 153 | } |
| 154 | return map; |
| 155 | } |
| 156 | |
| 157 | void soc_power_states_generation(int core_id, int cores_per_package) |
| 158 | { |
| 159 | config_t *config = config_of_soc(); |
| 160 | |
| 161 | /* Generate P-state tables */ |
| 162 | if (config->eist_enable) |
| 163 | generate_p_state_entries(core_id, cores_per_package); |
| 164 | } |
| 165 | |
| 166 | uint32_t soc_read_sci_irq_select(void) |
| 167 | { |
| 168 | return read32p(soc_read_pmc_base() + IRQ_REG); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Kyösti Mälkki | c2b0a4f | 2020-06-28 22:39:59 +0300 | [diff] [blame] | 171 | void soc_fill_gnvs(struct global_nvs *gnvs) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 172 | { |
Kyösti Mälkki | d5f645c | 2019-09-28 00:20:27 +0300 | [diff] [blame] | 173 | const struct soc_intel_skylake_config *config = config_of_soc(); |
Duncan Laurie | 7fce30c | 2015-09-04 13:53:14 -0700 | [diff] [blame] | 174 | |
Duncan Laurie | 7fce30c | 2015-09-04 13:53:14 -0700 | [diff] [blame] | 175 | /* Enable DPTF based on mainboard configuration */ |
| 176 | gnvs->dpte = config->dptf_enable; |
Duncan Laurie | 3d3b76b | 2016-02-25 08:45:43 -0800 | [diff] [blame] | 177 | |
Furquan Shaikh | 3bfe340 | 2016-10-18 14:25:25 -0700 | [diff] [blame] | 178 | /* Set USB2/USB3 wake enable bitmaps. */ |
| 179 | gnvs->u2we = config->usb2_wake_enable_bitmap; |
| 180 | gnvs->u3we = config->usb3_wake_enable_bitmap; |
Pratik Prajapati | 418535e | 2017-10-11 16:12:21 -0700 | [diff] [blame] | 181 | |
Michael Niewöhner | 7736bfc | 2019-10-22 23:05:06 +0200 | [diff] [blame] | 182 | if (CONFIG(SOC_INTEL_COMMON_BLOCK_SGX_ENABLE)) |
Pratik Prajapati | 418535e | 2017-10-11 16:12:21 -0700 | [diff] [blame] | 183 | sgx_fill_gnvs(gnvs); |
Subrata Banik | b6df6b0 | 2020-01-03 15:29:02 +0530 | [diff] [blame] | 184 | |
| 185 | /* Fill in Above 4GB MMIO resource */ |
| 186 | sa_fill_gnvs(gnvs); |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 189 | static unsigned long soc_fill_dmar(unsigned long current) |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 190 | { |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 191 | const u32 gfx_vtbar = MCHBAR32(GFXVTBAR) & ~0xfff; |
| 192 | const bool gfxvten = MCHBAR32(GFXVTBAR) & 1; |
| 193 | |
| 194 | /* iGFX has to be enabled, GFXVTBAR set and in 32-bit space. */ |
Angel Pons | 96a8013 | 2020-08-03 12:29:41 +0200 | [diff] [blame] | 195 | const bool emit_igd = |
Angel Pons | 7ff3f31 | 2021-06-23 12:13:57 +0200 | [diff] [blame] | 196 | is_devfn_enabled(SA_DEVFN_IGD) && |
Angel Pons | 96a8013 | 2020-08-03 12:29:41 +0200 | [diff] [blame] | 197 | gfx_vtbar && gfxvten && |
| 198 | !MCHBAR32(GFXVTBAR + 4); |
| 199 | |
| 200 | /* First, add DRHD entries */ |
| 201 | if (emit_igd) { |
| 202 | const unsigned long tmp = current; |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 203 | |
| 204 | current += acpi_create_dmar_drhd(current, 0, 0, gfx_vtbar); |
Matt DeVillier | 7866d49 | 2018-03-29 14:59:57 +0200 | [diff] [blame] | 205 | current += acpi_create_dmar_ds_pci(current, 0, 2, 0); |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 206 | |
| 207 | acpi_dmar_drhd_fixup(tmp, current); |
| 208 | } |
| 209 | |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 210 | const u32 vtvc0bar = MCHBAR32(VTVC0BAR) & ~0xfff; |
| 211 | const bool vtvc0en = MCHBAR32(VTVC0BAR) & 1; |
| 212 | |
| 213 | /* General VTBAR has to be set and in 32-bit space. */ |
Angel Pons | ef879a8 | 2019-08-30 19:42:23 +0200 | [diff] [blame] | 214 | if (vtvc0bar && vtvc0en && !MCHBAR32(VTVC0BAR + 4)) { |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 215 | const unsigned long tmp = current; |
| 216 | |
Angel Pons | ef879a8 | 2019-08-30 19:42:23 +0200 | [diff] [blame] | 217 | current += acpi_create_dmar_drhd(current, DRHD_INCLUDE_PCI_ALL, 0, vtvc0bar); |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 218 | |
Angel Pons | ef879a8 | 2019-08-30 19:42:23 +0200 | [diff] [blame] | 219 | current += acpi_create_dmar_ds_ioapic(current, 2, V_P2SB_IBDF_BUS, |
| 220 | V_P2SB_IBDF_DEV, V_P2SB_IBDF_FUN); |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 221 | |
Angel Pons | ef879a8 | 2019-08-30 19:42:23 +0200 | [diff] [blame] | 222 | current += acpi_create_dmar_ds_msi_hpet(current, 0, V_P2SB_HBDF_BUS, |
| 223 | V_P2SB_HBDF_DEV, V_P2SB_HBDF_FUN); |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 224 | |
| 225 | acpi_dmar_drhd_fixup(tmp, current); |
| 226 | } |
| 227 | |
Angel Pons | 96a8013 | 2020-08-03 12:29:41 +0200 | [diff] [blame] | 228 | /* Then, add RMRR entries after all DRHD entries */ |
| 229 | if (emit_igd) { |
| 230 | const unsigned long tmp = current; |
| 231 | |
| 232 | current += acpi_create_dmar_rmrr(current, 0, |
| 233 | sa_get_gsm_base(), sa_get_tolud_base() - 1); |
| 234 | current += acpi_create_dmar_ds_pci(current, 0, 2, 0); |
| 235 | acpi_dmar_rmrr_fixup(tmp, current); |
| 236 | } |
| 237 | |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 238 | return current; |
| 239 | } |
| 240 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 241 | unsigned long sa_write_acpi_tables(const struct device *const dev, |
| 242 | unsigned long current, |
| 243 | struct acpi_rsdp *const rsdp) |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 244 | { |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 245 | acpi_dmar_t *const dmar = (acpi_dmar_t *)current; |
| 246 | |
| 247 | /* Create DMAR table only if we have VT-d capability. */ |
Angel Pons | 00f53a8 | 2021-04-05 12:03:08 +0200 | [diff] [blame] | 248 | if (!soc_is_vtd_capable()) |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 249 | return current; |
| 250 | |
| 251 | printk(BIOS_DEBUG, "ACPI: * DMAR\n"); |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 252 | acpi_create_dmar(dmar, DMAR_INTR_REMAP, soc_fill_dmar); |
Nico Huber | c37b0e3 | 2017-09-18 20:03:46 +0200 | [diff] [blame] | 253 | current += dmar->header.length; |
| 254 | current = acpi_align_current(current); |
| 255 | acpi_add_table(rsdp, dmar); |
| 256 | |
| 257 | return current; |
| 258 | } |
| 259 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 260 | int soc_madt_sci_irq_polarity(int sci) |
Angel Pons | e4844ce | 2021-04-17 12:49:08 +0200 | [diff] [blame] | 261 | { |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 262 | if (sci >= 20) |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 263 | return MP_IRQ_POLARITY_LOW; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 264 | else |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 265 | return MP_IRQ_POLARITY_HIGH; |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 266 | } |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 267 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 268 | void acpi_fill_soc_wake(uint32_t *pm1_en, uint32_t *gpe0_en, |
| 269 | const struct chipset_power_state *ps) |
Duncan Laurie | a1c8b34d | 2015-09-08 16:12:44 -0700 | [diff] [blame] | 270 | { |
Kyösti Mälkki | d5f645c | 2019-09-28 00:20:27 +0300 | [diff] [blame] | 271 | const struct soc_intel_skylake_config *config = config_of_soc(); |
Duncan Laurie | a1c8b34d | 2015-09-08 16:12:44 -0700 | [diff] [blame] | 272 | |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 273 | if (ps->prev_sleep_state == ACPI_S3 && deep_s3_enabled()) { |
Duncan Laurie | 95f9020 | 2016-10-25 20:07:22 -0700 | [diff] [blame] | 274 | if (config->deep_sx_config & DSX_EN_LAN_WAKE_PIN) |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 275 | gpe0_en[GPE_STD] |= LAN_WAK_EN; |
Duncan Laurie | 95f9020 | 2016-10-25 20:07:22 -0700 | [diff] [blame] | 276 | if (config->deep_sx_config & DSX_EN_WAKE_PIN) |
Michael Niewöhner | f6611a2 | 2020-08-03 16:53:41 +0200 | [diff] [blame^] | 277 | *pm1_en |= PCIEXPWAK_STS; |
Duncan Laurie | 95f9020 | 2016-10-25 20:07:22 -0700 | [diff] [blame] | 278 | } |
Duncan Laurie | a1c8b34d | 2015-09-08 16:12:44 -0700 | [diff] [blame] | 279 | } |