Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
Elyes Haouas | 8ed5835 | 2022-10-22 22:17:28 +0200 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 4 | #include <acpi/acpigen.h> |
Tim Wawrzynczak | 3573038 | 2021-09-14 11:54:47 -0600 | [diff] [blame] | 5 | #include <assert.h> |
Elyes Haouas | 8ed5835 | 2022-10-22 22:17:28 +0200 | [diff] [blame] | 6 | #include <commonlib/bsd/helpers.h> |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 7 | #include <console/console.h> |
Subrata Banik | 8b223d4 | 2023-02-17 02:22:31 +0530 | [diff] [blame] | 8 | #include <device/pci_def.h> |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 9 | #include <intelblocks/acpi.h> |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 10 | #include <intelblocks/pmc_ipc.h> |
| 11 | #include <stdlib.h> |
Elyes Haouas | 8ed5835 | 2022-10-22 22:17:28 +0200 | [diff] [blame] | 12 | #include <string.h> |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 13 | #include <types.h> |
| 14 | |
| 15 | #define LPI_S0_HELPER_UUID "c4eb40a0-6cd2-11e2-bcfd-0800200c9a66" |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 16 | #define PEP_S0IX_UUID "57a6512e-3979-4e9d-9708-ff13b2508972" |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 17 | #define SYSTEM_POWER_MANAGEMENT_HID "INT33A1" |
| 18 | #define SYSTEM_POWER_MANAGEMENT_CID "PNP0D80" |
| 19 | #define EC_S0IX_HOOK "\\_SB.PCI0.LPCB.EC0.S0IX" |
Michael Niewöhner | a972e23 | 2022-05-18 22:27:13 +0200 | [diff] [blame] | 20 | #define EC_DISPLAY_HOOK "\\_SB.PCI0.LPCB.EC0.EDSX" |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 21 | #define MAINBOARD_HOOK "\\_SB.MS0X" |
Michał Żygowski | 2b87b50 | 2022-02-22 12:36:32 +0100 | [diff] [blame] | 22 | #define MAINBOARD_DISPLAY_HOOK "\\_SB.MDSX" |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 23 | #define ENABLE_PM_BITS_HOOK "\\_SB.PCI0.EGPM" |
| 24 | #define RESTORE_PM_BITS_HOOK "\\_SB.PCI0.RGPM" |
Michał Kopeć | 86221c6 | 2022-05-02 10:24:41 +0200 | [diff] [blame] | 25 | #define THUNDERBOLT_DEVICE "\\_SB.PCI0.TXHC" |
| 26 | #define THUNDERBOLT_IOM_DPOF "\\_SB.PCI0.DPOF" |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 27 | #define PEPD_SCOPE "\\_SB.PCI0" |
| 28 | |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 29 | #define MIN_DEVICE_STATE ACPI_DEVICE_SLEEP_D0 |
| 30 | #define LPI_STATES_ALL 0xff |
| 31 | |
| 32 | enum { |
| 33 | LPI_REVISION_0 = 0, |
| 34 | }; |
| 35 | |
| 36 | enum { |
| 37 | LPI_DISABLED = 0, |
| 38 | LPI_ENABLED = 1, |
| 39 | }; |
| 40 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 41 | struct reg_info { |
| 42 | uint8_t *addr; |
| 43 | size_t buffer_size; |
| 44 | }; |
| 45 | |
| 46 | static void read_pmc_lpm_requirements(const struct soc_pmc_lpm *lpm, |
| 47 | struct reg_info *info) |
| 48 | { |
Tim Wawrzynczak | 3573038 | 2021-09-14 11:54:47 -0600 | [diff] [blame] | 49 | assert(info); |
| 50 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 51 | if (!CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_PEP_LPM_REQ) || !lpm) { |
| 52 | memset(info, 0, sizeof(*info)); |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | const size_t register_count = lpm->num_substates * lpm->num_req_regs; |
| 57 | uint32_t *reg = calloc(register_count, sizeof(uint32_t)); |
| 58 | |
| 59 | /* Read the various LPM state requirement registers from the PMC */ |
| 60 | for (size_t i = 0; i < lpm->num_substates; i++) { |
| 61 | if (!(lpm->lpm_enable_mask & BIT(i))) |
| 62 | continue; |
| 63 | |
| 64 | for (size_t j = 0; j < lpm->num_req_regs; j++) { |
| 65 | const uint32_t offset = lpm->lpm_ipc_offset + |
| 66 | i * lpm->req_reg_stride + |
| 67 | j * sizeof(uint32_t); |
Ethan Tsao | eaf71b0 | 2021-10-13 12:37:05 -0700 | [diff] [blame] | 68 | const uint32_t cmd_reg = pmc_make_ipc_cmd(PMC_IPC_CMD_RD_PMC_REG, |
| 69 | PMC_IPC_CMD_SUBCMD_RD_PMC_REG, 0); |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 70 | struct pmc_ipc_buffer req = {.buf[0] = offset}; |
| 71 | struct pmc_ipc_buffer res = {}; |
| 72 | |
| 73 | enum cb_err result = pmc_send_ipc_cmd(cmd_reg, &req, &res); |
| 74 | if (result != CB_SUCCESS) { |
| 75 | printk(BIOS_ERR, "Failed to retrieve LPM substate registers" |
Paul Menzel | 5ca0015 | 2021-11-09 21:56:09 +0100 | [diff] [blame] | 76 | "from LPM, substate %zu, reg %zu\n", i, j); |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | uint32_t *ptr = reg + i * lpm->num_req_regs + j; |
| 80 | *ptr = res.buf[0]; |
| 81 | } |
| 82 | } |
| 83 | |
Tim Wawrzynczak | 3573038 | 2021-09-14 11:54:47 -0600 | [diff] [blame] | 84 | info->addr = (uint8_t *)reg; |
| 85 | info->buffer_size = register_count * sizeof(uint32_t); |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 86 | } |
| 87 | |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 88 | /* |
Tim Wawrzynczak | 7a94ad7 | 2022-02-11 09:46:15 -0700 | [diff] [blame] | 89 | * Windows expects a non-empty package for this subfunction, otherwise it |
| 90 | * results in a bluescreen (`INTERNAL_POWER_ERROR`); returning an empty package |
| 91 | * does not work. To workaround this, return a package describing a single |
| 92 | * device, one that is known to exist, i.e. ACPI_CPU_STRING. expects at least |
| 93 | * one device and crashes without it with a bluescreen. |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 94 | */ |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 95 | static void acpi_gen_default_lpi_constraints(void) |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 96 | { |
Tarun Tuli | c66ea98 | 2022-05-03 20:35:47 +0000 | [diff] [blame] | 97 | printk(BIOS_INFO, "Returning default LPI constraint package\n"); |
Tim Wawrzynczak | 7a94ad7 | 2022-02-11 09:46:15 -0700 | [diff] [blame] | 98 | |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 99 | /* |
| 100 | * Return (Package() { |
Tim Wawrzynczak | 7a94ad7 | 2022-02-11 09:46:15 -0700 | [diff] [blame] | 101 | * Package() { "\_SB.CP00", 0, |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 102 | * Package() { 0, |
| 103 | * Package() { 0xff, 0 }}}}) |
| 104 | */ |
| 105 | acpigen_emit_byte(RETURN_OP); |
| 106 | acpigen_write_package(1); |
| 107 | { |
| 108 | acpigen_write_package(3); |
| 109 | { |
Felix Held | 5edb518 | 2023-01-25 16:44:20 +0100 | [diff] [blame] | 110 | acpigen_write_processor_namestring(0); |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 111 | acpigen_write_integer(0); /* device disabled */ |
| 112 | acpigen_write_package(2); |
| 113 | { |
| 114 | acpigen_write_integer(0); /* revision */ |
| 115 | acpigen_write_package(2); |
| 116 | { |
| 117 | acpigen_write_integer(LPI_STATES_ALL); |
| 118 | acpigen_write_integer(MIN_DEVICE_STATE); |
| 119 | } |
| 120 | acpigen_write_package_end(); |
| 121 | } |
| 122 | acpigen_write_package_end(); |
| 123 | } |
| 124 | acpigen_write_package_end(); |
| 125 | } |
| 126 | acpigen_write_package_end(); |
| 127 | } |
| 128 | |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 129 | __weak struct min_sleep_state *soc_get_min_sleep_state_array(size_t *size) |
| 130 | { |
| 131 | printk(BIOS_DEBUG, "Empty min sleep state array returned\n"); |
| 132 | *size = 0; |
| 133 | return NULL; |
| 134 | } |
| 135 | |
| 136 | static enum acpi_device_sleep_states get_min_sleep_state( |
| 137 | const struct device *dev, struct min_sleep_state *states_arr, size_t size) |
| 138 | { |
| 139 | if (!is_dev_enabled(dev)) |
| 140 | return ACPI_DEVICE_SLEEP_NONE; |
| 141 | switch (dev->path.type) { |
| 142 | case DEVICE_PATH_APIC: |
| 143 | return MIN_DEVICE_STATE; |
| 144 | |
| 145 | case DEVICE_PATH_PCI: |
| 146 | /* skip external buses*/ |
| 147 | if ((dev->bus->secondary != 0) || (!states_arr)) |
| 148 | return ACPI_DEVICE_SLEEP_NONE; |
| 149 | for (size_t i = 0; i < size; i++) |
| 150 | if (states_arr[i].pci_dev == dev->path.pci.devfn) |
| 151 | return states_arr[i].min_sleep_state; |
Subrata Banik | 8b223d4 | 2023-02-17 02:22:31 +0530 | [diff] [blame] | 152 | printk(BIOS_WARNING, "Unknown min d_state for PCI: 00:%02x.%01x\n", |
| 153 | PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn)); |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 154 | return ACPI_DEVICE_SLEEP_NONE; |
| 155 | |
| 156 | default: |
| 157 | return ACPI_DEVICE_SLEEP_NONE; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /* Generate the LPI constraint table */ |
| 162 | static void acpi_lpi_get_constraints(void *unused) |
| 163 | { |
| 164 | unsigned int num_entries = 0; |
| 165 | const struct device *dev; |
| 166 | enum acpi_device_sleep_states min_sleep_state; |
| 167 | size_t size; |
| 168 | struct min_sleep_state *states_arr = soc_get_min_sleep_state_array(&size); |
| 169 | |
| 170 | if (size && states_arr) { |
| 171 | for (dev = all_devices; dev; dev = dev->next) { |
| 172 | if (get_min_sleep_state(dev, states_arr, size) |
| 173 | != ACPI_DEVICE_SLEEP_NONE) |
| 174 | num_entries++; |
| 175 | } |
| 176 | } |
| 177 | if (!num_entries) { |
| 178 | acpi_gen_default_lpi_constraints(); |
| 179 | } else { |
| 180 | acpigen_emit_byte(RETURN_OP); |
| 181 | acpigen_write_package(num_entries); |
| 182 | |
| 183 | size_t cpu_index = 0; |
| 184 | for (dev = all_devices; dev; dev = dev->next) { |
| 185 | min_sleep_state = get_min_sleep_state(dev, states_arr, size); |
| 186 | if (min_sleep_state == ACPI_DEVICE_SLEEP_NONE) |
| 187 | continue; |
| 188 | |
| 189 | acpigen_write_package(3); |
| 190 | { |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 191 | /* Emit the device path */ |
| 192 | switch (dev->path.type) { |
| 193 | case DEVICE_PATH_PCI: |
| 194 | acpigen_emit_namestring(acpi_device_path(dev)); |
| 195 | break; |
| 196 | |
| 197 | case DEVICE_PATH_APIC: |
Felix Held | 5edb518 | 2023-01-25 16:44:20 +0100 | [diff] [blame] | 198 | acpigen_write_processor_namestring(cpu_index++); |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 199 | break; |
| 200 | |
| 201 | default: |
| 202 | /* Unhandled */ |
| 203 | printk(BIOS_WARNING, |
| 204 | "Unhandled device path type %d\n", |
| 205 | dev->path.type); |
| 206 | acpigen_emit_namestring(NULL); |
| 207 | break; |
| 208 | } |
| 209 | |
| 210 | acpigen_write_integer(LPI_ENABLED); |
| 211 | acpigen_write_package(2); |
| 212 | { |
| 213 | acpigen_write_integer(LPI_REVISION_0); |
| 214 | acpigen_write_package(2); /* no optional device info */ |
| 215 | { |
| 216 | /* Assume constraints apply to all entries */ |
| 217 | acpigen_write_integer(LPI_STATES_ALL); |
| 218 | /* min D-state */ |
| 219 | acpigen_write_integer(min_sleep_state); |
| 220 | } |
| 221 | acpigen_write_package_end(); |
| 222 | } |
| 223 | acpigen_write_package_end(); |
| 224 | } |
| 225 | acpigen_write_package_end(); |
| 226 | } |
| 227 | acpigen_write_package_end(); |
| 228 | } |
| 229 | } |
| 230 | |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 231 | static void lpi_s0ix_entry(void *unused) |
| 232 | { |
| 233 | /* Inform the EC */ |
| 234 | acpigen_write_if_cond_ref_of(EC_S0IX_HOOK); |
| 235 | acpigen_emit_namestring(EC_S0IX_HOOK); |
| 236 | acpigen_write_integer(1); |
| 237 | acpigen_write_if_end(); |
| 238 | |
| 239 | /* Provide a board level S0ix hook */ |
| 240 | acpigen_write_if_cond_ref_of(MAINBOARD_HOOK); |
| 241 | acpigen_emit_namestring(MAINBOARD_HOOK); |
| 242 | acpigen_write_integer(1); |
| 243 | acpigen_write_if_end(); |
| 244 | |
| 245 | /* Save the current PM bits then enable GPIO PM with |
| 246 | MISCCFG_GPIO_PM_CONFIG_BITS */ |
| 247 | acpigen_write_if_cond_ref_of(ENABLE_PM_BITS_HOOK); |
| 248 | acpigen_emit_namestring(ENABLE_PM_BITS_HOOK); |
| 249 | acpigen_write_if_end(); |
Michał Kopeć | 86221c6 | 2022-05-02 10:24:41 +0200 | [diff] [blame] | 250 | |
| 251 | /* Handle Thunderbolt displays */ |
Usha P | 05e88fe | 2023-06-08 09:55:38 +0530 | [diff] [blame] | 252 | if (CONFIG(FIRMWARE_CONNECTION_MANAGER)) { |
| 253 | acpigen_write_if_cond_ref_of(THUNDERBOLT_DEVICE); |
| 254 | acpigen_write_store_int_to_namestr(1, THUNDERBOLT_IOM_DPOF); |
| 255 | acpigen_write_if_end(); |
| 256 | } |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | static void lpi_s0ix_exit(void *unused) |
| 260 | { |
| 261 | /* Inform the EC */ |
| 262 | acpigen_write_if_cond_ref_of(EC_S0IX_HOOK); |
| 263 | acpigen_emit_namestring(EC_S0IX_HOOK); |
| 264 | acpigen_write_integer(0); |
| 265 | acpigen_write_if_end(); |
| 266 | |
| 267 | /* Provide a board level S0ix hook */ |
| 268 | acpigen_write_if_cond_ref_of(MAINBOARD_HOOK); |
| 269 | acpigen_emit_namestring(MAINBOARD_HOOK); |
| 270 | acpigen_write_integer(0); |
| 271 | acpigen_write_if_end(); |
| 272 | |
| 273 | /* Restore GPIO all Community PM */ |
| 274 | acpigen_write_if_cond_ref_of(RESTORE_PM_BITS_HOOK); |
| 275 | acpigen_emit_namestring(RESTORE_PM_BITS_HOOK); |
| 276 | acpigen_write_if_end(); |
Michał Kopeć | 86221c6 | 2022-05-02 10:24:41 +0200 | [diff] [blame] | 277 | |
| 278 | /* Handle Thunderbolt displays */ |
Usha P | 05e88fe | 2023-06-08 09:55:38 +0530 | [diff] [blame] | 279 | if (CONFIG(FIRMWARE_CONNECTION_MANAGER)) { |
| 280 | acpigen_write_if_cond_ref_of(THUNDERBOLT_DEVICE); |
| 281 | acpigen_write_store_int_to_namestr(0, THUNDERBOLT_IOM_DPOF); |
| 282 | acpigen_write_if_end(); |
| 283 | } |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 284 | } |
| 285 | |
Michał Żygowski | 2b87b50 | 2022-02-22 12:36:32 +0100 | [diff] [blame] | 286 | static void lpi_display_on(void *unused) |
| 287 | { |
Michael Niewöhner | a972e23 | 2022-05-18 22:27:13 +0200 | [diff] [blame] | 288 | /* Inform the EC */ |
| 289 | acpigen_write_if_cond_ref_of(EC_DISPLAY_HOOK); |
| 290 | acpigen_emit_namestring(EC_DISPLAY_HOOK); |
| 291 | acpigen_write_integer(1); |
| 292 | acpigen_write_if_end(); |
| 293 | |
Michał Żygowski | 2b87b50 | 2022-02-22 12:36:32 +0100 | [diff] [blame] | 294 | /* Provide a board level S0ix hook */ |
| 295 | acpigen_write_if_cond_ref_of(MAINBOARD_DISPLAY_HOOK); |
| 296 | acpigen_emit_namestring(MAINBOARD_DISPLAY_HOOK); |
| 297 | acpigen_write_integer(1); |
| 298 | acpigen_write_if_end(); |
| 299 | } |
| 300 | |
| 301 | static void lpi_display_off(void *unused) |
| 302 | { |
Michael Niewöhner | a972e23 | 2022-05-18 22:27:13 +0200 | [diff] [blame] | 303 | /* Inform the EC */ |
| 304 | acpigen_write_if_cond_ref_of(EC_DISPLAY_HOOK); |
| 305 | acpigen_emit_namestring(EC_DISPLAY_HOOK); |
| 306 | acpigen_write_integer(0); |
| 307 | acpigen_write_if_end(); |
| 308 | |
Michał Żygowski | 2b87b50 | 2022-02-22 12:36:32 +0100 | [diff] [blame] | 309 | /* Provide a board level S0ix hook */ |
| 310 | acpigen_write_if_cond_ref_of(MAINBOARD_DISPLAY_HOOK); |
| 311 | acpigen_emit_namestring(MAINBOARD_DISPLAY_HOOK); |
| 312 | acpigen_write_integer(0); |
| 313 | acpigen_write_if_end(); |
| 314 | } |
| 315 | |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 316 | static void (*lpi_s0_helpers[])(void *) = { |
| 317 | NULL, /* enumerate functions (autogenerated) */ |
Eran Mitrani | 4c9440c | 2022-11-29 17:46:38 -0800 | [diff] [blame] | 318 | acpi_lpi_get_constraints,/* get device constraints */ |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 319 | NULL, /* get crash dump device */ |
Michał Żygowski | 2b87b50 | 2022-02-22 12:36:32 +0100 | [diff] [blame] | 320 | lpi_display_off, /* display off notify */ |
| 321 | lpi_display_on, /* display on notify */ |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 322 | lpi_s0ix_entry, /* s0ix entry */ |
| 323 | lpi_s0ix_exit, /* s0ix exit */ |
| 324 | }; |
| 325 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 326 | static void pep_s0ix_return_lpm_requirements(void *arg) |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 327 | { |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 328 | if (!CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_PEP_LPM_REQ)) { |
| 329 | acpigen_write_return_singleton_buffer(0x0); |
| 330 | return; |
| 331 | } |
| 332 | |
| 333 | struct reg_info *info = (struct reg_info *)arg; |
| 334 | acpigen_write_return_byte_buffer(info->addr, info->buffer_size); |
| 335 | } |
| 336 | |
| 337 | static void (*pep_s0ix[])(void *) = { |
| 338 | NULL, /* enumerate functions (autogenerated) */ |
| 339 | pep_s0ix_return_lpm_requirements, /* Return LPM requirements */ |
| 340 | }; |
| 341 | |
| 342 | void generate_acpi_power_engine_with_lpm(const struct soc_pmc_lpm *lpm) |
| 343 | { |
| 344 | struct reg_info info; |
| 345 | size_t uuid_count = 1; |
| 346 | struct dsm_uuid ids[] = { |
| 347 | DSM_UUID(LPI_S0_HELPER_UUID, lpi_s0_helpers, ARRAY_SIZE(lpi_s0_helpers), NULL), |
| 348 | DSM_UUID(PEP_S0IX_UUID, pep_s0ix, ARRAY_SIZE(pep_s0ix), &info), |
| 349 | }; |
| 350 | |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 351 | acpigen_write_scope(PEPD_SCOPE); |
| 352 | acpigen_write_device("PEPD"); |
| 353 | |
| 354 | acpigen_write_name_string("_HID", SYSTEM_POWER_MANAGEMENT_HID); |
| 355 | acpigen_write_name("_CID"); |
| 356 | acpigen_emit_eisaid(SYSTEM_POWER_MANAGEMENT_CID); |
| 357 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 358 | read_pmc_lpm_requirements(lpm, &info); |
| 359 | if (info.buffer_size) |
| 360 | uuid_count++; |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 361 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 362 | acpigen_write_dsm_uuid_arr(ids, uuid_count); |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 363 | acpigen_write_device_end(); |
| 364 | acpigen_write_scope_end(); |
| 365 | |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 366 | free(info.addr); |
Tim Wawrzynczak | 6424648 | 2021-06-25 22:44:45 -0600 | [diff] [blame] | 367 | printk(BIOS_INFO, PEPD_SCOPE ".PEPD: Intel Power Engine Plug-in\n"); |
| 368 | } |
Tim Wawrzynczak | 2eb100d | 2021-07-01 08:20:17 -0600 | [diff] [blame] | 369 | |
| 370 | void generate_acpi_power_engine(void) |
| 371 | { |
| 372 | generate_acpi_power_engine_with_lpm(NULL); |
| 373 | } |