| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpi.h> |
| 4 |
#include <acpi/acpi_device.h> |
| 5 |
#include <acpi/acpigen.h> |
| 6 |
#include <device/device.h> |
| 7 |
#include <device/pci.h> |
| 8 |
#include <device/pci_ids.h> |
| 9 |
#include <intelblocks/cnvi.h> |
| 10 |
#include <soc/cnvi.h> |
| 11 |
#include <soc/pcr_ids.h> |
| 12 |
|
| 13 |
#include "chip.h" |
| 14 |
|
| 15 |
static const char *cnvi_wifi_acpi_name(const struct device *dev) |
| 16 |
{ |
| 17 |
return "CNVW"; |
| 18 |
} |
| 19 |
|
| 20 |
static void cnvw_fill_ssdt(const struct device *dev) |
| 21 |
{ |
| 22 |
const char *scope = acpi_device_path(dev); |
| 23 |
|
| 24 |
acpi_device_write_pci_dev(dev); |
| 25 |
|
| 26 |
acpigen_write_scope(scope); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
acpigen_write_store(); |
| 45 |
acpigen_emit_namestring("\\_SB_.PCI0.BASE"); |
| 46 |
acpigen_emit_namestring("_ADR"); |
| 47 |
acpigen_emit_byte(LOCAL0_OP); |
| 48 |
|
| 49 |
|
| 50 |
acpigen_emit_ext_op(OPREGION_OP); |
| 51 |
|
| 52 |
acpigen_emit_namestring("CWAR"); |
| 53 |
|
| 54 |
acpigen_emit_byte(SYSTEMMEMORY); |
| 55 |
|
| 56 |
acpigen_emit_byte(LOCAL0_OP); |
| 57 |
|
| 58 |
acpigen_write_integer(0x100); |
| 59 |
|
| 60 |
struct fieldlist fields[] = { |
| 61 |
FIELDLIST_OFFSET(0), |
| 62 |
FIELDLIST_NAMESTR("VDID", 32), |
| 63 |
FIELDLIST_OFFSET(CNVI_DEV_CAP), |
| 64 |
FIELDLIST_RESERVED(28), |
| 65 |
FIELDLIST_NAMESTR("WFLR", 1), |
| 66 |
FIELDLIST_OFFSET(CNVI_DEV_CONTROL), |
| 67 |
FIELDLIST_RESERVED(15), |
| 68 |
FIELDLIST_NAMESTR("WIFR", 1), |
| 69 |
FIELDLIST_OFFSET(CNVI_POWER_STATUS), |
| 70 |
FIELDLIST_NAMESTR("WPMS", 32), |
| 71 |
}; |
| 72 |
acpigen_write_field("CWAR", fields, ARRAY_SIZE(fields), |
| 73 |
FIELD_WORDACC | FIELD_NOLOCK | FIELD_PRESERVE); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
struct fieldlist fields2[] = { |
| 85 |
FIELDLIST_OFFSET(0xcd), |
| 86 |
FIELDLIST_NAMESTR("PMEE", 1), |
| 87 |
FIELDLIST_RESERVED(6), |
| 88 |
FIELDLIST_NAMESTR("PMES", 1), |
| 89 |
}; |
| 90 |
acpigen_write_field("CWAR", fields2, ARRAY_SIZE(fields2), |
| 91 |
FIELD_BYTEACC | FIELD_NOLOCK | FIELD_PRESERVE); |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D3_HOT); |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
acpigen_write_name_integer("PRRS", 0); |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
acpigen_write_name_integer("RSTT", 0); |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
acpigen_write_name_integer("WFDL", 50); |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
acpigen_write_power_res("CNVP", 0, 0, NULL, 0); |
| 223 |
{ |
| 224 |
acpigen_write_method("_STA", 0); |
| 225 |
{ |
| 226 |
acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVS"); |
| 227 |
{ |
| 228 |
acpigen_write_store(); |
| 229 |
acpigen_emit_namestring("\\_SB.PCI0.CNVS"); |
| 230 |
acpigen_emit_byte(LOCAL0_OP); |
| 231 |
|
| 232 |
acpigen_write_return_op(LOCAL0_OP); |
| 233 |
} |
| 234 |
acpigen_write_else(); |
| 235 |
{ |
| 236 |
acpigen_write_return_integer(1); |
| 237 |
} |
| 238 |
acpigen_pop_len(); |
| 239 |
} |
| 240 |
acpigen_pop_len(); |
| 241 |
|
| 242 |
acpigen_write_method("_ON", 0); |
| 243 |
{ |
| 244 |
acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); |
| 245 |
{ |
| 246 |
|
| 247 |
acpigen_write_store(); |
| 248 |
acpigen_emit_namestring("\\_SB.PCI0.CNVS"); |
| 249 |
acpigen_emit_byte(LOCAL0_OP); |
| 250 |
|
| 251 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, 1); |
| 252 |
{ |
| 253 |
acpigen_write_return_integer(1); |
| 254 |
} |
| 255 |
acpigen_pop_len(); |
| 256 |
|
| 257 |
acpigen_emit_namestring("\\_SB.PCI0.CNVC"); |
| 258 |
acpigen_emit_byte(1); |
| 259 |
} |
| 260 |
acpigen_pop_len(); |
| 261 |
} |
| 262 |
acpigen_pop_len(); |
| 263 |
|
| 264 |
acpigen_write_method("_OFF", 0); |
| 265 |
{ |
| 266 |
acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); |
| 267 |
{ |
| 268 |
acpigen_emit_namestring("\\_SB.PCI0.CNVC"); |
| 269 |
acpigen_emit_byte(0); |
| 270 |
} |
| 271 |
acpigen_pop_len(); |
| 272 |
} |
| 273 |
acpigen_pop_len(); |
| 274 |
|
| 275 |
acpigen_write_method("_RST", 0); |
| 276 |
{ |
| 277 |
acpigen_write_store(); |
| 278 |
acpigen_write_acquire("\\_SB.PCI0.CNMT", 1000); |
| 279 |
acpigen_emit_byte(LOCAL0_OP); |
| 280 |
|
| 281 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, 0); |
| 282 |
{ |
| 283 |
acpigen_emit_namestring("CFLR"); |
| 284 |
|
| 285 |
acpigen_write_store_int_to_namestr(1, "PRRS"); |
| 286 |
|
| 287 |
acpigen_write_if_lequal_namestr_int("RSTT", 1); |
| 288 |
{ |
| 289 |
acpigen_write_store(); |
| 290 |
acpigen_emit_namestring("\\_SB.PCI0.PCRR"); |
| 291 |
acpigen_write_integer(PID_CNVI); |
| 292 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 293 |
acpigen_emit_byte(LOCAL0_OP); |
| 294 |
|
| 295 |
acpigen_emit_byte(AND_OP); |
| 296 |
acpigen_emit_byte(LOCAL0_OP); |
| 297 |
acpigen_write_integer(CNVI_ABORT_REQUEST); |
| 298 |
acpigen_emit_byte(LOCAL0_OP); |
| 299 |
|
| 300 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, 0); |
| 301 |
{ |
| 302 |
acpigen_write_store_int_to_op(0, LOCAL2_OP); |
| 303 |
acpigen_write_if_cond_ref_of("\\_SB.PCI0.GBTR"); |
| 304 |
{ |
| 305 |
acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.GBTR", 1); |
| 306 |
{ |
| 307 |
acpigen_emit_namestring("\\_SB.PCI0.BTRK"); |
| 308 |
acpigen_emit_byte(0); |
| 309 |
|
| 310 |
acpigen_write_sleep(160); |
| 311 |
|
| 312 |
acpigen_write_store_ops(1, LOCAL2_OP); |
| 313 |
} |
| 314 |
acpigen_pop_len(); |
| 315 |
} |
| 316 |
acpigen_pop_len(); |
| 317 |
|
| 318 |
acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVB"); |
| 319 |
{ |
| 320 |
acpigen_emit_namestring("\\_SB.PCI0.CNVB.CFLR"); |
| 321 |
} |
| 322 |
acpigen_pop_len(); |
| 323 |
|
| 324 |
acpigen_emit_namestring("\\_SB.PCI0.PCRO"); |
| 325 |
acpigen_write_integer(PID_CNVI); |
| 326 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 327 |
acpigen_write_integer(CNVI_ABORT_REQUEST | CNVI_ABORT_ENABLE); |
| 328 |
|
| 329 |
acpigen_emit_ext_op(SLEEP_OP); |
| 330 |
acpigen_emit_namestring("WFDL"); |
| 331 |
|
| 332 |
acpigen_write_store(); |
| 333 |
acpigen_emit_namestring("\\_SB.PCI0.PCRR"); |
| 334 |
acpigen_write_integer(PID_CNVI); |
| 335 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 336 |
acpigen_emit_byte(LOCAL0_OP); |
| 337 |
|
| 338 |
acpigen_emit_byte(AND_OP); |
| 339 |
acpigen_emit_byte(LOCAL0_OP); |
| 340 |
acpigen_write_integer(CNVI_ABORT_REQUEST); |
| 341 |
acpigen_emit_byte(LOCAL1_OP); |
| 342 |
|
| 343 |
acpigen_emit_byte(AND_OP); |
| 344 |
acpigen_emit_byte(LOCAL0_OP); |
| 345 |
acpigen_write_integer(CNVI_READY); |
| 346 |
acpigen_emit_byte(LOCAL3_OP); |
| 347 |
|
| 348 |
acpigen_write_if_lequal_op_int(LOCAL1_OP, 0); |
| 349 |
{ |
| 350 |
acpigen_write_if_lequal_op_int(LOCAL3_OP, CNVI_READY); |
| 351 |
{ |
| 352 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_COMPLETE, "PRRS"); |
| 353 |
|
| 354 |
acpigen_write_if_lequal_op_int(LOCAL2_OP, 1); |
| 355 |
{ |
| 356 |
acpigen_emit_namestring("\\_SB.PCI0.BTRK"); |
| 357 |
acpigen_emit_byte(1); |
| 358 |
acpigen_write_sleep(160); |
| 359 |
} |
| 360 |
acpigen_pop_len(); |
| 361 |
} |
| 362 |
acpigen_pop_len(); |
| 363 |
} |
| 364 |
acpigen_write_else(); |
| 365 |
{ |
| 366 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_NOT_COMPLETE, "PRRS"); |
| 367 |
} |
| 368 |
acpigen_pop_len(); |
| 369 |
} |
| 370 |
acpigen_write_else(); |
| 371 |
{ |
| 372 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_TIMEOUT, "PRRS"); |
| 373 |
} |
| 374 |
acpigen_pop_len(); |
| 375 |
} |
| 376 |
acpigen_pop_len(); |
| 377 |
acpigen_write_release("\\_SB.PCI0.CNMT"); |
| 378 |
} |
| 379 |
acpigen_pop_len(); |
| 380 |
} |
| 381 |
acpigen_pop_len(); |
| 382 |
} |
| 383 |
acpigen_write_power_res_end(); |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
acpigen_write_name("_PRR"); |
| 392 |
{ |
| 393 |
acpigen_write_package(1); |
| 394 |
acpigen_emit_namestring("CNVP"); |
| 395 |
} |
| 396 |
acpigen_pop_len(); |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
acpigen_write_name("_PR0"); |
| 405 |
{ |
| 406 |
acpigen_write_package(1); |
| 407 |
acpigen_emit_namestring("CNVP"); |
| 408 |
} |
| 409 |
acpigen_pop_len(); |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
acpigen_write_method("GPEH", 0); |
| 425 |
{ |
| 426 |
acpigen_write_if_lequal_namestr_int("VDID", 0xffffffff); |
| 427 |
{ |
| 428 |
acpigen_write_return_integer(0); |
| 429 |
} |
| 430 |
acpigen_pop_len(); |
| 431 |
|
| 432 |
acpigen_write_if_lequal_namestr_int("PMES", 1); |
| 433 |
{ |
| 434 |
acpigen_notify("CNVW", 2); |
| 435 |
} |
| 436 |
acpigen_pop_len(); |
| 437 |
} |
| 438 |
acpigen_pop_len(); |
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
acpigen_write_method("CFLR", 0); |
| 450 |
{ |
| 451 |
acpigen_write_if_lequal_namestr_int("WFLR", 1); |
| 452 |
{ |
| 453 |
acpigen_write_store_int_to_namestr(1, "WIFR"); |
| 454 |
} |
| 455 |
acpigen_pop_len(); |
| 456 |
} |
| 457 |
acpigen_pop_len(); |
| 458 |
|
| 459 |
acpigen_write_scope_end(); |
| 460 |
} |
| 461 |
|
| 462 |
static struct device_operations cnvi_wifi_ops = { |
| 463 |
.read_resources = pci_dev_read_resources, |
| 464 |
.set_resources = pci_dev_set_resources, |
| 465 |
.enable_resources = pci_dev_enable_resources, |
| 466 |
.ops_pci = &pci_dev_ops_pci, |
| 467 |
.scan_bus = scan_static_bus, |
| 468 |
.acpi_name = cnvi_wifi_acpi_name, |
| 469 |
.acpi_fill_ssdt = cnvw_fill_ssdt, |
| 470 |
}; |
| 471 |
|
| 472 |
static const unsigned short wifi_pci_device_ids[] = { |
| 473 |
PCI_DID_INTEL_WCL_CNVI_WIFI_0, |
| 474 |
PCI_DID_INTEL_WCL_CNVI_WIFI_1, |
| 475 |
PCI_DID_INTEL_WCL_CNVI_WIFI_2, |
| 476 |
PCI_DID_INTEL_WCL_CNVI_WIFI_3, |
| 477 |
PCI_DID_INTEL_PTL_H_CNVI_WIFI_0, |
| 478 |
PCI_DID_INTEL_PTL_H_CNVI_WIFI_1, |
| 479 |
PCI_DID_INTEL_PTL_H_CNVI_WIFI_2, |
| 480 |
PCI_DID_INTEL_PTL_H_CNVI_WIFI_3, |
| 481 |
PCI_DID_INTEL_PTL_U_H_CNVI_WIFI_0, |
| 482 |
PCI_DID_INTEL_PTL_U_H_CNVI_WIFI_1, |
| 483 |
PCI_DID_INTEL_PTL_U_H_CNVI_WIFI_2, |
| 484 |
PCI_DID_INTEL_PTL_U_H_CNVI_WIFI_3, |
| 485 |
PCI_DID_INTEL_LNL_CNVI_WIFI_0, |
| 486 |
PCI_DID_INTEL_LNL_CNVI_WIFI_1, |
| 487 |
PCI_DID_INTEL_LNL_CNVI_WIFI_2, |
| 488 |
PCI_DID_INTEL_LNL_CNVI_WIFI_3, |
| 489 |
PCI_DID_INTEL_MTL_CNVI_WIFI_0, |
| 490 |
PCI_DID_INTEL_MTL_CNVI_WIFI_1, |
| 491 |
PCI_DID_INTEL_MTL_CNVI_WIFI_2, |
| 492 |
PCI_DID_INTEL_MTL_CNVI_WIFI_3, |
| 493 |
PCI_DID_INTEL_ARL_CNVI_WIFI, |
| 494 |
PCI_DID_INTEL_ARP_S_CNVI_WIFI, |
| 495 |
PCI_DID_INTEL_CML_LP_CNVI_WIFI, |
| 496 |
PCI_DID_INTEL_CML_H_CNVI_WIFI, |
| 497 |
PCI_DID_INTEL_CNL_LP_CNVI_WIFI, |
| 498 |
PCI_DID_INTEL_CNL_H_CNVI_WIFI, |
| 499 |
PCI_DID_INTEL_GLK_CNVI_WIFI, |
| 500 |
PCI_DID_INTEL_JSL_CNVI_WIFI_0, |
| 501 |
PCI_DID_INTEL_JSL_CNVI_WIFI_1, |
| 502 |
PCI_DID_INTEL_JSL_CNVI_WIFI_2, |
| 503 |
PCI_DID_INTEL_JSL_CNVI_WIFI_3, |
| 504 |
PCI_DID_INTEL_TGL_CNVI_WIFI_0, |
| 505 |
PCI_DID_INTEL_TGL_CNVI_WIFI_1, |
| 506 |
PCI_DID_INTEL_TGL_CNVI_WIFI_2, |
| 507 |
PCI_DID_INTEL_TGL_CNVI_WIFI_3, |
| 508 |
PCI_DID_INTEL_TGL_H_CNVI_WIFI_0, |
| 509 |
PCI_DID_INTEL_TGL_H_CNVI_WIFI_1, |
| 510 |
PCI_DID_INTEL_TGL_H_CNVI_WIFI_2, |
| 511 |
PCI_DID_INTEL_TGL_H_CNVI_WIFI_3, |
| 512 |
PCI_DID_INTEL_ADL_P_CNVI_WIFI_0, |
| 513 |
PCI_DID_INTEL_ADL_P_CNVI_WIFI_1, |
| 514 |
PCI_DID_INTEL_ADL_P_CNVI_WIFI_2, |
| 515 |
PCI_DID_INTEL_ADL_P_CNVI_WIFI_3, |
| 516 |
PCI_DID_INTEL_ADL_S_CNVI_WIFI_0, |
| 517 |
PCI_DID_INTEL_ADL_S_CNVI_WIFI_1, |
| 518 |
PCI_DID_INTEL_ADL_S_CNVI_WIFI_2, |
| 519 |
PCI_DID_INTEL_ADL_S_CNVI_WIFI_3, |
| 520 |
PCI_DID_INTEL_ADL_N_CNVI_WIFI_0, |
| 521 |
PCI_DID_INTEL_ADL_N_CNVI_WIFI_1, |
| 522 |
PCI_DID_INTEL_ADL_N_CNVI_WIFI_2, |
| 523 |
PCI_DID_INTEL_ADL_N_CNVI_WIFI_3, |
| 524 |
PCI_DID_INTEL_RPL_S_CNVI_WIFI_0, |
| 525 |
PCI_DID_INTEL_RPL_S_CNVI_WIFI_1, |
| 526 |
PCI_DID_INTEL_RPL_S_CNVI_WIFI_2, |
| 527 |
PCI_DID_INTEL_RPL_S_CNVI_WIFI_3, |
| 528 |
0 |
| 529 |
}; |
| 530 |
|
| 531 |
static const struct pci_driver pch_cnvi_wifi __pci_driver = { |
| 532 |
.ops = &cnvi_wifi_ops, |
| 533 |
.vendor = PCI_VID_INTEL, |
| 534 |
.devices = wifi_pci_device_ids, |
| 535 |
}; |
| 536 |
|
| 537 |
static const char *cnvi_bt_acpi_name(const struct device *dev) |
| 538 |
{ |
| 539 |
return "CNVB"; |
| 540 |
} |
| 541 |
|
| 542 |
static void cnvb_fill_ssdt(const struct device *dev) |
| 543 |
{ |
| 544 |
const char *scope = acpi_device_path(dev); |
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
acpigen_write_scope("\\_SB.PCI0"); |
| 550 |
acpigen_write_mutex("CNMT", 0); |
| 551 |
acpigen_write_scope_end(); |
| 552 |
|
| 553 |
acpi_device_write_pci_dev(dev); |
| 554 |
|
| 555 |
acpigen_write_scope(scope); |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
acpigen_write_store(); |
| 579 |
acpigen_emit_namestring("BASE"); |
| 580 |
acpigen_emit_namestring("_ADR"); |
| 581 |
acpigen_emit_byte(LOCAL0_OP); |
| 582 |
|
| 583 |
acpigen_emit_ext_op(OPREGION_OP); |
| 584 |
acpigen_emit_namestring("CBTR"); |
| 585 |
acpigen_emit_byte(SYSTEMMEMORY); |
| 586 |
acpigen_emit_byte(LOCAL0_OP); |
| 587 |
acpigen_write_integer(0x100); |
| 588 |
|
| 589 |
struct fieldlist fields[] = { |
| 590 |
FIELDLIST_OFFSET(0), |
| 591 |
FIELDLIST_NAMESTR("VDID", 32), |
| 592 |
FIELDLIST_OFFSET(CNVI_DEV_CAP), |
| 593 |
FIELDLIST_RESERVED(28), |
| 594 |
FIELDLIST_NAMESTR("BFLR", 1), |
| 595 |
FIELDLIST_OFFSET(CNVI_DEV_CONTROL), |
| 596 |
FIELDLIST_RESERVED(15), |
| 597 |
FIELDLIST_NAMESTR("BIFR", 1), |
| 598 |
FIELDLIST_OFFSET(CNVI_DEV_CAP_2), |
| 599 |
FIELDLIST_RESERVED(11), |
| 600 |
FIELDLIST_NAMESTR("BLTS", 1), |
| 601 |
FIELDLIST_OFFSET(CNVI_DEV_CONTROL_2), |
| 602 |
FIELDLIST_RESERVED(10), |
| 603 |
FIELDLIST_NAMESTR("BLTE", 1), |
| 604 |
}; |
| 605 |
acpigen_write_field("CBTR", fields, ARRAY_SIZE(fields), |
| 606 |
FIELD_WORDACC | FIELD_NOLOCK | FIELD_PRESERVE); |
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D3_HOT); |
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
acpigen_write_name_integer("PRRS", 0); |
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
acpigen_write_name_integer("RSTT", 0); |
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
acpigen_write_name_integer("BTDL", 50); |
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
acpigen_write_power_res("CNVP", 5, 0, NULL, 0); |
| 702 |
{ |
| 703 |
acpigen_write_method("_STA", 0); |
| 704 |
{ |
| 705 |
acpigen_write_return_integer(1); |
| 706 |
} |
| 707 |
acpigen_pop_len(); |
| 708 |
|
| 709 |
acpigen_write_method("_ON", 0); |
| 710 |
{ |
| 711 |
|
| 712 |
} |
| 713 |
acpigen_pop_len(); |
| 714 |
|
| 715 |
acpigen_write_method("_OFF", 0); |
| 716 |
{ |
| 717 |
|
| 718 |
} |
| 719 |
acpigen_pop_len(); |
| 720 |
|
| 721 |
acpigen_write_method("_RST", 0); |
| 722 |
{ |
| 723 |
acpigen_write_store(); |
| 724 |
acpigen_write_acquire("\\_SB.PCI0.CNMT", 1000); |
| 725 |
acpigen_emit_byte(LOCAL0_OP); |
| 726 |
|
| 727 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, 0); |
| 728 |
{ |
| 729 |
acpigen_emit_namestring("CFLR"); |
| 730 |
|
| 731 |
acpigen_write_if_lequal_namestr_int("RSTT", 1); |
| 732 |
{ |
| 733 |
acpigen_write_store(); |
| 734 |
acpigen_emit_namestring("\\_SB.PCI0.PCRR"); |
| 735 |
acpigen_write_integer(PID_CNVI); |
| 736 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 737 |
acpigen_emit_byte(LOCAL0_OP); |
| 738 |
|
| 739 |
acpigen_emit_byte(AND_OP); |
| 740 |
acpigen_emit_byte(LOCAL0_OP); |
| 741 |
acpigen_write_integer(CNVI_ABORT_REQUEST); |
| 742 |
acpigen_emit_byte(LOCAL0_OP); |
| 743 |
|
| 744 |
acpigen_write_if_lequal_op_int(LOCAL0_OP, 0); |
| 745 |
{ |
| 746 |
acpigen_emit_namestring("\\_SB.PCI0.PCRO"); |
| 747 |
acpigen_write_integer(PID_CNVI); |
| 748 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 749 |
acpigen_write_integer(CNVI_ABORT_REQUEST | CNVI_ABORT_ENABLE); |
| 750 |
|
| 751 |
acpigen_emit_ext_op(SLEEP_OP); |
| 752 |
acpigen_emit_namestring("BTDL"); |
| 753 |
|
| 754 |
acpigen_write_store(); |
| 755 |
acpigen_emit_namestring("\\_SB.PCI0.PCRR"); |
| 756 |
acpigen_write_integer(PID_CNVI); |
| 757 |
acpigen_write_integer(CNVI_ABORT_PLDR); |
| 758 |
acpigen_emit_byte(LOCAL0_OP); |
| 759 |
|
| 760 |
acpigen_emit_byte(AND_OP); |
| 761 |
acpigen_emit_byte(LOCAL0_OP); |
| 762 |
acpigen_write_integer(CNVI_ABORT_REQUEST); |
| 763 |
acpigen_emit_byte(LOCAL1_OP); |
| 764 |
|
| 765 |
acpigen_emit_byte(AND_OP); |
| 766 |
acpigen_emit_byte(LOCAL0_OP); |
| 767 |
acpigen_write_integer(CNVI_READY); |
| 768 |
acpigen_emit_byte(LOCAL3_OP); |
| 769 |
|
| 770 |
acpigen_write_if_lequal_op_int(LOCAL1_OP, 0); |
| 771 |
{ |
| 772 |
acpigen_write_if_lequal_op_int(LOCAL3_OP, CNVI_READY); |
| 773 |
{ |
| 774 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_COMPLETE, "PRRS"); |
| 775 |
} |
| 776 |
acpigen_pop_len(); |
| 777 |
} |
| 778 |
acpigen_write_else(); |
| 779 |
{ |
| 780 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_TIMEOUT, "PRRS"); |
| 781 |
} |
| 782 |
acpigen_pop_len(); |
| 783 |
} |
| 784 |
acpigen_write_else(); |
| 785 |
{ |
| 786 |
acpigen_write_store_int_to_namestr(CNVI_PLDR_NOT_COMPLETE, "PRRS"); |
| 787 |
} |
| 788 |
acpigen_pop_len(); |
| 789 |
} |
| 790 |
acpigen_pop_len(); |
| 791 |
|
| 792 |
acpigen_write_if_lequal_namestr_int("BLTS", 1); |
| 793 |
{ |
| 794 |
acpigen_write_if_lequal_namestr_int("BLTE", 0); |
| 795 |
{ |
| 796 |
acpigen_write_store_int_to_namestr(1, "BLTE"); |
| 797 |
} |
| 798 |
acpigen_pop_len(); |
| 799 |
} |
| 800 |
acpigen_pop_len(); |
| 801 |
|
| 802 |
acpigen_write_release("\\_SB.PCI0.CNMT"); |
| 803 |
} |
| 804 |
acpigen_pop_len(); |
| 805 |
} |
| 806 |
acpigen_pop_len(); |
| 807 |
} |
| 808 |
acpigen_write_power_res_end(); |
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
acpigen_write_name("_PRR"); |
| 817 |
{ |
| 818 |
acpigen_write_package(1); |
| 819 |
acpigen_emit_namestring("CNVP"); |
| 820 |
} |
| 821 |
acpigen_pop_len(); |
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
acpigen_write_method("CFLR", 0); |
| 834 |
{ |
| 835 |
acpigen_write_if_lequal_namestr_int("BFLR", 1); |
| 836 |
{ |
| 837 |
acpigen_write_store_int_to_namestr(1, "BIFR"); |
| 838 |
acpigen_write_store_int_to_namestr(1, "PRRS"); |
| 839 |
} |
| 840 |
acpigen_pop_len(); |
| 841 |
} |
| 842 |
acpigen_pop_len(); |
| 843 |
|
| 844 |
acpigen_write_scope_end(); |
| 845 |
} |
| 846 |
|
| 847 |
static struct device_operations cnvi_bt_ops = { |
| 848 |
.read_resources = pci_dev_read_resources, |
| 849 |
.set_resources = pci_dev_set_resources, |
| 850 |
.enable_resources = pci_dev_enable_resources, |
| 851 |
.ops_pci = &pci_dev_ops_pci, |
| 852 |
.scan_bus = scan_static_bus, |
| 853 |
.acpi_name = cnvi_bt_acpi_name, |
| 854 |
.acpi_fill_ssdt = cnvb_fill_ssdt, |
| 855 |
}; |
| 856 |
|
| 857 |
static const unsigned short bt_pci_device_ids[] = { |
| 858 |
PCI_DID_INTEL_WCL_CNVI_BT, |
| 859 |
PCI_DID_INTEL_PTL_H_CNVI_BT, |
| 860 |
PCI_DID_INTEL_PTL_U_H_CNVI_BT, |
| 861 |
PCI_DID_INTEL_TGL_CNVI_BT_0, |
| 862 |
PCI_DID_INTEL_TGL_CNVI_BT_1, |
| 863 |
PCI_DID_INTEL_TGL_CNVI_BT_2, |
| 864 |
PCI_DID_INTEL_TGL_CNVI_BT_3, |
| 865 |
PCI_DID_INTEL_TGL_H_CNVI_BT_0, |
| 866 |
PCI_DID_INTEL_TGL_H_CNVI_BT_1, |
| 867 |
PCI_DID_INTEL_TGL_H_CNVI_BT_2, |
| 868 |
0 |
| 869 |
}; |
| 870 |
|
| 871 |
static const struct pci_driver pch_cnvi_bt __pci_driver = { |
| 872 |
.ops = &cnvi_bt_ops, |
| 873 |
.vendor = PCI_VID_INTEL, |
| 874 |
.devices = bt_pci_device_ids, |
| 875 |
}; |
| 876 |
|
| 877 |
static const char *cnvi_acpi_name(const struct device *dev) |
| 878 |
{ |
| 879 |
const struct device *parent = dev->upstream->dev; |
| 880 |
return parent->ops->acpi_name(parent); |
| 881 |
} |
| 882 |
|
| 883 |
static void cnvi_acpi_fill_ssdt(const struct device *dev) |
| 884 |
{ |
| 885 |
const struct device *parent = dev->upstream->dev; |
| 886 |
const char *scope = acpi_device_path(parent); |
| 887 |
acpigen_write_scope(scope); |
| 888 |
|
| 889 |
const struct soc_intel_common_block_cnvi_config *config = dev->chip_info; |
| 890 |
if (config) { |
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
acpigen_write_PRW(config->wake, ACPI_S3); |
| 898 |
} |
| 899 |
acpigen_write_scope_end(); |
| 900 |
} |
| 901 |
|
| 902 |
static struct device_operations cnvi_ops = { |
| 903 |
.read_resources = noop_read_resources, |
| 904 |
.set_resources = noop_set_resources, |
| 905 |
.acpi_fill_ssdt = cnvi_acpi_fill_ssdt, |
| 906 |
.acpi_name = cnvi_acpi_name, |
| 907 |
}; |
| 908 |
|
| 909 |
static void cnvi_enable_dev(struct device *dev) |
| 910 |
{ |
| 911 |
dev->ops = &cnvi_ops; |
| 912 |
} |
| 913 |
|
| 914 |
struct chip_operations soc_intel_common_block_cnvi_ops = { |
| 915 |
.name = "CNVi Device", |
| 916 |
.enable_dev = cnvi_enable_dev, |
| 917 |
}; |