| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <acpi/acpi_device.h> |
| 5 |
#include <console/console.h> |
| 6 |
#include <device/device.h> |
| 7 |
#include <device/pci_ids.h> |
| 8 |
#include <device/pci_ops.h> |
| 9 |
#include <device/pci.h> |
| 10 |
#include <intelblocks/pmc.h> |
| 11 |
#include <intelblocks/pmc_ipc.h> |
| 12 |
#include <intelblocks/pcie_rp.h> |
| 13 |
#include <soc/iomap.h> |
| 14 |
#include "chip.h" |
| 15 |
|
| 16 |
|
| 17 |
#define PCH_PCIE_CFG_LSTS 0x52 |
| 18 |
#define PCH_PCIE_CFG_SPR 0xe0 |
| 19 |
#define PCH_PCIE_CFG_RPPGEN 0xe2 |
| 20 |
#define PCH_PCIE_CFG_LCAP_PN 0x4f |
| 21 |
|
| 22 |
|
| 23 |
#define ACPI_REG_PCI_LINK_ACTIVE "LASX" |
| 24 |
#define ACPI_REG_PCI_L23_RDY_ENTRY "L23E" |
| 25 |
#define ACPI_REG_PCI_L23_RDY_DETECT "L23R" |
| 26 |
#define ACPI_REG_PCI_L23_SAVE_STATE "NCB7" |
| 27 |
|
| 28 |
|
| 29 |
#define RTD3_MUTEX_PATH "\\_SB.PCI0.R3MX" |
| 30 |
|
| 31 |
|
| 32 |
#define RTD3_PCIE_CLK_ENABLE_PATH "\\_SB.PCI0.SPCO" |
| 33 |
|
| 34 |
enum modphy_pg_state { |
| 35 |
PG_DISABLE = 0, |
| 36 |
PG_ENABLE = 1, |
| 37 |
}; |
| 38 |
|
| 39 |
|
| 40 |
static void pcie_rtd3_acpi_l23_exit(void) |
| 41 |
{ |
| 42 |
|
| 43 |
acpigen_write_if_lequal_namestr_int(ACPI_REG_PCI_L23_SAVE_STATE, 1); |
| 44 |
|
| 45 |
|
| 46 |
acpigen_write_store_int_to_namestr(1, ACPI_REG_PCI_L23_RDY_DETECT); |
| 47 |
|
| 48 |
|
| 49 |
acpigen_write_delay_until_namestr_int(320, ACPI_REG_PCI_L23_RDY_DETECT, 0); |
| 50 |
|
| 51 |
acpigen_write_store_int_to_namestr(0, ACPI_REG_PCI_L23_SAVE_STATE); |
| 52 |
|
| 53 |
|
| 54 |
acpigen_write_delay_until_namestr_int(128, ACPI_REG_PCI_LINK_ACTIVE, 1); |
| 55 |
|
| 56 |
acpigen_pop_len(); |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
static void pcie_rtd3_acpi_l23_entry(void) |
| 61 |
{ |
| 62 |
|
| 63 |
acpigen_write_store_int_to_namestr(1, ACPI_REG_PCI_L23_RDY_ENTRY); |
| 64 |
|
| 65 |
|
| 66 |
acpigen_write_delay_until_namestr_int(128, ACPI_REG_PCI_L23_RDY_ENTRY, 0); |
| 67 |
|
| 68 |
acpigen_write_store_int_to_namestr(1, ACPI_REG_PCI_L23_SAVE_STATE); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
static void pcie_rtd3_enable_modphy_pg(unsigned int pcie_rp, enum modphy_pg_state state) |
| 73 |
{ |
| 74 |
|
| 75 |
acpigen_emit_ext_op(ACQUIRE_OP); |
| 76 |
acpigen_emit_namestring(RTD3_MUTEX_PATH); |
| 77 |
acpigen_emit_word(ACPI_MUTEX_NO_TIMEOUT); |
| 78 |
|
| 79 |
acpigen_write_store_int_to_namestr(state, "EMPG"); |
| 80 |
acpigen_write_delay_until_namestr_int(100, "AMPG", state); |
| 81 |
|
| 82 |
|
| 83 |
acpigen_emit_ext_op(RELEASE_OP); |
| 84 |
acpigen_emit_namestring(RTD3_MUTEX_PATH); |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
static void pcie_rtd3_acpi_method_dl23(void) |
| 89 |
{ |
| 90 |
acpigen_write_method_serialized("DL23", 0); |
| 91 |
pcie_rtd3_acpi_l23_entry(); |
| 92 |
acpigen_pop_len(); |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
static void pcie_rtd3_acpi_method_l23d(void) |
| 97 |
{ |
| 98 |
acpigen_write_method_serialized("L23D", 0); |
| 99 |
pcie_rtd3_acpi_l23_exit(); |
| 100 |
acpigen_pop_len(); |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
static void pcie_rtd3_acpi_method_pds0(unsigned int pcie_rp) |
| 105 |
{ |
| 106 |
acpigen_write_method_serialized("PSD0", 0); |
| 107 |
pcie_rtd3_enable_modphy_pg(pcie_rp, PG_DISABLE); |
| 108 |
acpigen_pop_len(); |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
static void pcie_rtd3_acpi_method_srck(unsigned int pcie_rp, |
| 113 |
const struct soc_intel_common_block_pcie_rtd3_config *config) |
| 114 |
{ |
| 115 |
acpigen_write_method_serialized("SRCK", 1); |
| 116 |
|
| 117 |
if (config->srcclk_pin >= 0) { |
| 118 |
acpigen_write_if_lequal_op_op(ARG0_OP, 0); |
| 119 |
pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, false); |
| 120 |
acpigen_write_else(); |
| 121 |
pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, true); |
| 122 |
acpigen_pop_len(); |
| 123 |
} |
| 124 |
acpigen_pop_len(); |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
static void p2sb_acpi_set_pci_clock(u8 srcclk_pin, bool enable) |
| 129 |
{ |
| 130 |
acpigen_write_if_cond_ref_of(RTD3_PCIE_CLK_ENABLE_PATH); |
| 131 |
acpigen_emit_namestring(RTD3_PCIE_CLK_ENABLE_PATH); |
| 132 |
acpigen_write_integer(srcclk_pin); |
| 133 |
acpigen_write_integer(enable); |
| 134 |
acpigen_write_if_end(); |
| 135 |
} |
| 136 |
|
| 137 |
static void |
| 138 |
pcie_rtd3_acpi_method_on(unsigned int pcie_rp, |
| 139 |
const struct soc_intel_common_block_pcie_rtd3_config *config, |
| 140 |
enum pcie_rp_type rp_type, |
| 141 |
const struct device *dev) |
| 142 |
{ |
| 143 |
const struct device *parent = dev->upstream->dev; |
| 144 |
|
| 145 |
acpigen_write_method_serialized("_ON", 0); |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
if (config->skip_on_off_support) |
| 152 |
acpigen_write_if_lequal_namestr_int("ONSK", 0); |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
acpigen_write_store(); |
| 164 |
acpigen_emit_namestring(acpi_device_path_join(parent, "RTD3._STA")); |
| 165 |
acpigen_emit_byte(LOCAL0_OP); |
| 166 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, ONE_OP); |
| 167 |
acpigen_write_return_op(ONE_OP); |
| 168 |
acpigen_write_if_end(); |
| 169 |
|
| 170 |
if (config->use_rp_mutex) |
| 171 |
acpigen_write_acquire(acpi_device_path_join(parent, RP_MUTEX_NAME), |
| 172 |
ACPI_MUTEX_NO_TIMEOUT); |
| 173 |
|
| 174 |
|
| 175 |
if (rp_type == PCIE_RP_PCH) |
| 176 |
pcie_rtd3_enable_modphy_pg(pcie_rp, PG_DISABLE); |
| 177 |
|
| 178 |
|
| 179 |
if (config->enable_gpio.pin_count) { |
| 180 |
acpigen_enable_tx_gpio(&config->enable_gpio); |
| 181 |
if (config->enable_delay_ms) |
| 182 |
acpigen_write_sleep(config->enable_delay_ms); |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
if (config->srcclk_pin >= 0) { |
| 187 |
if (CONFIG(PCIE_CLOCK_CONTROL_THROUGH_P2SB)) |
| 188 |
p2sb_acpi_set_pci_clock(config->srcclk_pin, true); |
| 189 |
else |
| 190 |
pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, true); |
| 191 |
} |
| 192 |
|
| 193 |
|
| 194 |
if (config->reset_gpio.pin_count) { |
| 195 |
acpigen_disable_tx_gpio(&config->reset_gpio); |
| 196 |
if (config->reset_delay_ms) |
| 197 |
acpigen_write_sleep(config->reset_delay_ms); |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
if (!config->disable_l23) |
| 202 |
pcie_rtd3_acpi_l23_exit(); |
| 203 |
|
| 204 |
if (config->use_rp_mutex) |
| 205 |
acpigen_write_release(acpi_device_path_join(parent, RP_MUTEX_NAME)); |
| 206 |
|
| 207 |
if (config->skip_on_off_support) { |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
acpigen_write_else(); |
| 212 |
acpigen_emit_byte(DECREMENT_OP); |
| 213 |
acpigen_emit_namestring("ONSK"); |
| 214 |
|
| 215 |
acpigen_pop_len(); |
| 216 |
} |
| 217 |
acpigen_pop_len(); |
| 218 |
} |
| 219 |
|
| 220 |
static void |
| 221 |
pcie_rtd3_acpi_method_off(int pcie_rp, |
| 222 |
const struct soc_intel_common_block_pcie_rtd3_config *config, |
| 223 |
enum pcie_rp_type rp_type, |
| 224 |
const struct device *dev) |
| 225 |
|
| 226 |
{ |
| 227 |
const struct device *parent = dev->upstream->dev; |
| 228 |
|
| 229 |
acpigen_write_method_serialized("_OFF", 0); |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
if (config->skip_on_off_support) |
| 237 |
acpigen_write_if_lequal_namestr_int("OFSK", 0); |
| 238 |
|
| 239 |
if (config->use_rp_mutex) |
| 240 |
acpigen_write_acquire(acpi_device_path_join(parent, RP_MUTEX_NAME), |
| 241 |
ACPI_MUTEX_NO_TIMEOUT); |
| 242 |
|
| 243 |
|
| 244 |
if (!config->disable_l23) |
| 245 |
pcie_rtd3_acpi_l23_entry(); |
| 246 |
|
| 247 |
|
| 248 |
if (config->reset_gpio.pin_count) { |
| 249 |
acpigen_enable_tx_gpio(&config->reset_gpio); |
| 250 |
if (config->reset_off_delay_ms) |
| 251 |
acpigen_write_sleep(config->reset_off_delay_ms); |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
if (rp_type == PCIE_RP_PCH) |
| 256 |
pcie_rtd3_enable_modphy_pg(pcie_rp, PG_ENABLE); |
| 257 |
|
| 258 |
|
| 259 |
if (config->srcclk_pin >= 0) { |
| 260 |
if (CONFIG(PCIE_CLOCK_CONTROL_THROUGH_P2SB)) |
| 261 |
p2sb_acpi_set_pci_clock(config->srcclk_pin, false); |
| 262 |
else |
| 263 |
pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, false); |
| 264 |
} |
| 265 |
|
| 266 |
|
| 267 |
if (config->enable_gpio.pin_count) { |
| 268 |
acpigen_disable_tx_gpio(&config->enable_gpio); |
| 269 |
if (config->enable_off_delay_ms) |
| 270 |
acpigen_write_sleep(config->enable_off_delay_ms); |
| 271 |
} |
| 272 |
|
| 273 |
if (config->use_rp_mutex) |
| 274 |
acpigen_write_release(acpi_device_path_join(parent, RP_MUTEX_NAME)); |
| 275 |
|
| 276 |
if (config->skip_on_off_support) { |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
acpigen_write_else(); |
| 283 |
|
| 284 |
acpigen_emit_byte(DECREMENT_OP); |
| 285 |
acpigen_emit_namestring("OFSK"); |
| 286 |
|
| 287 |
acpigen_emit_byte(INCREMENT_OP); |
| 288 |
acpigen_emit_namestring("ONSK"); |
| 289 |
|
| 290 |
acpigen_pop_len(); |
| 291 |
} |
| 292 |
acpigen_pop_len(); |
| 293 |
} |
| 294 |
|
| 295 |
static void |
| 296 |
pcie_rtd3_acpi_method_status(const struct soc_intel_common_block_pcie_rtd3_config *config) |
| 297 |
{ |
| 298 |
const struct acpi_gpio *gpio; |
| 299 |
|
| 300 |
acpigen_write_method("_STA", 0); |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
if (config->enable_gpio.pin_count) { |
| 325 |
gpio = &config->enable_gpio; |
| 326 |
|
| 327 |
acpigen_get_tx_gpio(gpio); |
| 328 |
} else { |
| 329 |
gpio = &config->reset_gpio; |
| 330 |
|
| 331 |
acpigen_get_tx_gpio(gpio); |
| 332 |
acpigen_write_not(LOCAL0_OP, LOCAL0_OP); |
| 333 |
} |
| 334 |
acpigen_write_return_op(LOCAL0_OP); |
| 335 |
acpigen_pop_len(); |
| 336 |
} |
| 337 |
|
| 338 |
static void write_modphy_opregion(unsigned int pcie_rp) |
| 339 |
{ |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
const struct opregion opregion = OPREGION("PMCP", SYSTEMMEMORY, |
| 344 |
PCH_PWRM_BASE_ADDRESS + 0x1000, 0xff); |
| 345 |
const struct fieldlist fieldlist[] = { |
| 346 |
FIELDLIST_OFFSET(0xD0), |
| 347 |
FIELDLIST_RESERVED(pcie_rp), |
| 348 |
FIELDLIST_NAMESTR("EMPG", 1), |
| 349 |
FIELDLIST_OFFSET(0xD4), |
| 350 |
FIELDLIST_RESERVED(pcie_rp), |
| 351 |
FIELDLIST_NAMESTR("AMPG", 1), |
| 352 |
}; |
| 353 |
|
| 354 |
acpigen_write_opregion(&opregion); |
| 355 |
acpigen_write_field("PMCP", fieldlist, ARRAY_SIZE(fieldlist), |
| 356 |
FIELD_DWORDACC | FIELD_NOLOCK | FIELD_PRESERVE); |
| 357 |
} |
| 358 |
|
| 359 |
static int get_pcie_rp_pmc_idx(enum pcie_rp_type rp_type, const struct device *dev) |
| 360 |
{ |
| 361 |
int idx = -1; |
| 362 |
|
| 363 |
switch (rp_type) { |
| 364 |
case PCIE_RP_PCH: |
| 365 |
|
| 366 |
idx = pci_read_config8(dev, PCH_PCIE_CFG_LCAP_PN); |
| 367 |
|
| 368 |
|
| 369 |
idx--; |
| 370 |
break; |
| 371 |
case PCIE_RP_CPU: |
| 372 |
|
| 373 |
idx = soc_get_cpu_rp_vw_idx(dev); |
| 374 |
break; |
| 375 |
default: |
| 376 |
break; |
| 377 |
} |
| 378 |
|
| 379 |
return idx; |
| 380 |
} |
| 381 |
|
| 382 |
static void pcie_rtd3_acpi_fill_ssdt(const struct device *dev) |
| 383 |
{ |
| 384 |
static bool mutex_created = false; |
| 385 |
|
| 386 |
const struct soc_intel_common_block_pcie_rtd3_config *config = config_of(dev); |
| 387 |
static const char *const power_res_states[] = {"_PR0"}; |
| 388 |
const struct device *parent = dev->upstream->dev; |
| 389 |
const char *scope = acpi_device_path(parent); |
| 390 |
const struct opregion opregion = OPREGION("PXCS", PCI_CONFIG, 0, 0xff); |
| 391 |
const struct fieldlist fieldlist[] = { |
| 392 |
FIELDLIST_OFFSET(PCH_PCIE_CFG_LSTS), |
| 393 |
FIELDLIST_RESERVED(13), |
| 394 |
FIELDLIST_NAMESTR(ACPI_REG_PCI_LINK_ACTIVE, 1), |
| 395 |
FIELDLIST_OFFSET(PCH_PCIE_CFG_SPR), |
| 396 |
FIELDLIST_RESERVED(7), |
| 397 |
FIELDLIST_NAMESTR(ACPI_REG_PCI_L23_SAVE_STATE, 1), |
| 398 |
FIELDLIST_OFFSET(PCH_PCIE_CFG_RPPGEN), |
| 399 |
FIELDLIST_RESERVED(2), |
| 400 |
FIELDLIST_NAMESTR(ACPI_REG_PCI_L23_RDY_ENTRY, 1), |
| 401 |
FIELDLIST_NAMESTR(ACPI_REG_PCI_L23_RDY_DETECT, 1), |
| 402 |
}; |
| 403 |
int pcie_rp; |
| 404 |
struct acpi_dp *dsd; |
| 405 |
|
| 406 |
if (!is_dev_enabled(parent)) { |
| 407 |
printk(BIOS_ERR, "%s: root port not enabled\n", __func__); |
| 408 |
return; |
| 409 |
} |
| 410 |
if (!scope) { |
| 411 |
printk(BIOS_ERR, "%s: root port scope not found\n", __func__); |
| 412 |
return; |
| 413 |
} |
| 414 |
if (!config->enable_gpio.pin_count && !config->reset_gpio.pin_count) { |
| 415 |
printk(BIOS_ERR, "%s: Enable and/or Reset GPIO required for %s.\n", |
| 416 |
__func__, scope); |
| 417 |
return; |
| 418 |
} |
| 419 |
if (config->srcclk_pin > CONFIG_MAX_PCIE_CLOCK_SRC) { |
| 420 |
printk(BIOS_ERR, "%s: Invalid clock pin %u for %s.\n", __func__, |
| 421 |
config->srcclk_pin, scope); |
| 422 |
return; |
| 423 |
} |
| 424 |
|
| 425 |
const enum pcie_rp_type rp_type = soc_get_pcie_rp_type(parent); |
| 426 |
pcie_rp = get_pcie_rp_pmc_idx(rp_type, parent); |
| 427 |
if (pcie_rp < 0) { |
| 428 |
printk(BIOS_ERR, "%s: Unknown PCIe root port\n", __func__); |
| 429 |
return; |
| 430 |
} |
| 431 |
if (config->disable_l23) { |
| 432 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_L23) { |
| 433 |
printk(BIOS_ERR, "%s: Can not export L23 methods\n", __func__); |
| 434 |
return; |
| 435 |
} |
| 436 |
} |
| 437 |
if (rp_type != PCIE_RP_PCH) { |
| 438 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_PSD0) { |
| 439 |
printk(BIOS_ERR, "%s: Can not export PSD0 method\n", __func__); |
| 440 |
return; |
| 441 |
} |
| 442 |
} |
| 443 |
if (config->srcclk_pin == -1) { |
| 444 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_SRCK) { |
| 445 |
printk(BIOS_ERR, "%s: Can not export SRCK method since clock source gating is not enabled\n", |
| 446 |
__func__); |
| 447 |
return; |
| 448 |
} |
| 449 |
} |
| 450 |
|
| 451 |
printk(BIOS_INFO, "%s: Enable RTD3 for %s (%s)\n", scope, dev_path(parent), |
| 452 |
config->desc ?: dev->chip_ops->name); |
| 453 |
|
| 454 |
|
| 455 |
if (rp_type == PCIE_RP_PCH && !mutex_created) { |
| 456 |
acpigen_write_scope("\\_SB.PCI0"); |
| 457 |
acpigen_write_mutex("R3MX", 0); |
| 458 |
acpigen_write_scope_end(); |
| 459 |
mutex_created = true; |
| 460 |
} |
| 461 |
|
| 462 |
|
| 463 |
acpigen_write_scope(scope); |
| 464 |
|
| 465 |
if (config->use_rp_mutex) |
| 466 |
acpigen_write_mutex(RP_MUTEX_NAME, 0); |
| 467 |
|
| 468 |
if (config->desc) |
| 469 |
acpigen_write_name_string("_DDN", config->desc); |
| 470 |
|
| 471 |
|
| 472 |
acpigen_write_opregion(&opregion); |
| 473 |
acpigen_write_field("PXCS", fieldlist, ARRAY_SIZE(fieldlist), |
| 474 |
FIELD_ANYACC | FIELD_NOLOCK | FIELD_PRESERVE); |
| 475 |
|
| 476 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_L23) { |
| 477 |
pcie_rtd3_acpi_method_dl23(); |
| 478 |
pcie_rtd3_acpi_method_l23d(); |
| 479 |
} |
| 480 |
|
| 481 |
|
| 482 |
if (rp_type == PCIE_RP_PCH) |
| 483 |
write_modphy_opregion(pcie_rp); |
| 484 |
|
| 485 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_PSD0) |
| 486 |
pcie_rtd3_acpi_method_pds0(pcie_rp); |
| 487 |
|
| 488 |
if (config->ext_pm_support & ACPI_PCIE_RP_EMIT_SRCK) |
| 489 |
pcie_rtd3_acpi_method_srck(pcie_rp, config); |
| 490 |
|
| 491 |
|
| 492 |
acpigen_write_power_res("RTD3", 0, 0, power_res_states, ARRAY_SIZE(power_res_states)); |
| 493 |
|
| 494 |
if (config->skip_on_off_support) { |
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
acpigen_write_name_integer("ONSK", 0); |
| 505 |
acpigen_write_name_integer("OFSK", 0); |
| 506 |
} |
| 507 |
|
| 508 |
pcie_rtd3_acpi_method_status(config); |
| 509 |
pcie_rtd3_acpi_method_on(pcie_rp, config, rp_type, dev); |
| 510 |
pcie_rtd3_acpi_method_off(pcie_rp, config, rp_type, dev); |
| 511 |
acpigen_pop_len(); |
| 512 |
|
| 513 |
|
| 514 |
dsd = acpi_dp_new_table("_DSD"); |
| 515 |
acpi_device_add_hotplug_support_in_d3(dsd); |
| 516 |
|
| 517 |
|
| 518 |
if (config->add_acpi_external_facing_port) |
| 519 |
acpi_device_add_external_facing_port(dsd); |
| 520 |
|
| 521 |
|
| 522 |
if (config->add_acpi_dma_property) |
| 523 |
acpi_device_add_dma_property(dsd); |
| 524 |
|
| 525 |
acpi_dp_write(dsd); |
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
if (config->is_storage |
| 532 |
|| (dev->sibling && (dev->sibling->class >> 16) == PCI_BASE_CLASS_STORAGE)) { |
| 533 |
acpigen_write_device(acpi_device_name(dev)); |
| 534 |
acpigen_write_ADR(0); |
| 535 |
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON); |
| 536 |
if (CONFIG(D3COLD_SUPPORT)) |
| 537 |
acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D3_COLD); |
| 538 |
else |
| 539 |
acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D3_HOT); |
| 540 |
|
| 541 |
acpi_device_add_storage_d3_enable(NULL); |
| 542 |
|
| 543 |
acpigen_pop_len(); |
| 544 |
|
| 545 |
printk(BIOS_INFO, "%s: Added StorageD3Enable property\n", scope); |
| 546 |
} |
| 547 |
|
| 548 |
acpigen_pop_len(); |
| 549 |
} |
| 550 |
|
| 551 |
static const char *pcie_rtd3_acpi_name(const struct device *dev) |
| 552 |
{ |
| 553 |
|
| 554 |
return "PXSX"; |
| 555 |
} |
| 556 |
|
| 557 |
static struct device_operations pcie_rtd3_ops = { |
| 558 |
.read_resources = noop_read_resources, |
| 559 |
.set_resources = noop_set_resources, |
| 560 |
.acpi_fill_ssdt = pcie_rtd3_acpi_fill_ssdt, |
| 561 |
.acpi_name = pcie_rtd3_acpi_name, |
| 562 |
}; |
| 563 |
|
| 564 |
static void pcie_rtd3_acpi_enable(struct device *dev) |
| 565 |
{ |
| 566 |
dev->ops = &pcie_rtd3_ops; |
| 567 |
} |
| 568 |
|
| 569 |
struct chip_operations soc_intel_common_block_pcie_rtd3_ops = { |
| 570 |
.name = "Intel PCIe Runtime D3", |
| 571 |
.enable_dev = pcie_rtd3_acpi_enable |
| 572 |
}; |