| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpi_device.h> |
| 4 |
#include <acpi/acpigen.h> |
| 5 |
#include <acpi/acpigen_pci.h> |
| 6 |
#include <console/console.h> |
| 7 |
#include <device/pci_ids.h> |
| 8 |
#include <mtcl.h> |
| 9 |
#include <sar.h> |
| 10 |
#include <stdio.h> |
| 11 |
#include <stdlib.h> |
| 12 |
#include <wrdd.h> |
| 13 |
|
| 14 |
#include "chip.h" |
| 15 |
#include "wifi.h" |
| 16 |
#include "wifi_private.h" |
| 17 |
|
| 18 |
|
| 19 |
enum sar_domain { |
| 20 |
DOMAIN_TYPE_WIFI = 0x7, |
| 21 |
DOMAIN_TYPE_BLUETOOTH = 0x12 |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
#define MAX_DSM_FUNCS 2 |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
#define WIFI_ACPI_NAME_MAX_LEN 5 |
| 34 |
|
| 35 |
|
| 36 |
#define ACPI_DSM_OEM_WIFI_UUID "F21202BF-8F78-4DC6-A5B3-1F738E285ADE" |
| 37 |
|
| 38 |
|
| 39 |
#define ACPI_DSM_RFIM_WIFI_UUID "7266172C-220B-4B29-814F-75E4DD26B5FD" |
| 40 |
|
| 41 |
__weak int get_wifi_sar_limits(union wifi_sar_limits *sar_limits) |
| 42 |
{ |
| 43 |
return -1; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
static void wifi_dsm_srd_active_channels(void *args) |
| 54 |
{ |
| 55 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 56 |
|
| 57 |
acpigen_write_return_integer(dsm_config->disable_active_sdr_channels); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
static void wifi_dsm_indonasia_5Ghz_band_enable(void *args) |
| 67 |
{ |
| 68 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 69 |
|
| 70 |
acpigen_write_return_integer(dsm_config->support_indonesia_5g_band); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
static void wifi_dsm_supported_ultra_high_band(void *args) |
| 84 |
{ |
| 85 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 86 |
|
| 87 |
acpigen_write_return_integer(dsm_config->support_ultra_high_band); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
static void wifi_dsm_regulatory_configurations(void *args) |
| 94 |
{ |
| 95 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 96 |
|
| 97 |
acpigen_write_return_integer(dsm_config->regulatory_configurations); |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
static void wifi_dsm_uart_configurations(void *args) |
| 104 |
{ |
| 105 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 106 |
|
| 107 |
acpigen_write_return_integer(dsm_config->uart_configurations); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
static void wifi_dsm_ukrane_russia_11ax_enable(void *args) |
| 133 |
{ |
| 134 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 135 |
|
| 136 |
acpigen_write_return_integer(dsm_config->enablement_11ax); |
| 137 |
} |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
static void wifi_dsm_unii4_control_enable(void *args) |
| 143 |
{ |
| 144 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 145 |
|
| 146 |
acpigen_write_return_integer(dsm_config->unii_4); |
| 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 |
static void wifi_dsm_energy_detection_threshold(void *args) |
| 210 |
{ |
| 211 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 212 |
|
| 213 |
acpigen_write_return_integer(dsm_config->energy_detection_threshold); |
| 214 |
} |
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
static void wifi_dsm_rfi_mitigation(void *args) |
| 230 |
{ |
| 231 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 232 |
|
| 233 |
acpigen_write_return_integer(dsm_config->rfi_mitigation); |
| 234 |
} |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
static void wifi_dsm_11be_country_enablement(void *args) |
| 252 |
{ |
| 253 |
struct dsm_profile *dsm_config = (struct dsm_profile *)args; |
| 254 |
|
| 255 |
acpigen_write_return_integer(dsm_config->enablement_11be); |
| 256 |
} |
| 257 |
|
| 258 |
static void wifi_dsm_ddrrfim_func3_cb(void *ptr) |
| 259 |
{ |
| 260 |
const bool is_cnvi_ddr_rfim_enabled = *(bool *)ptr; |
| 261 |
acpigen_write_return_integer(is_cnvi_ddr_rfim_enabled ? 0 : 1); |
| 262 |
} |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
static void wifi_dsm_power_resource_for_reset(__always_unused void *args) |
| 279 |
{ |
| 280 |
acpigen_write_create_word_field(ARG3_OP, 0, "CMDT"); |
| 281 |
acpigen_write_create_word_field(ARG3_OP, 2, "CMDP"); |
| 282 |
|
| 283 |
|
| 284 |
acpigen_write_if_lequal_namestr_int("CMDT", 1); |
| 285 |
{ |
| 286 |
acpigen_write_if_cond_ref_of("RSTT"); |
| 287 |
{ |
| 288 |
acpigen_write_return_namestr("RSTT"); |
| 289 |
|
| 290 |
} |
| 291 |
acpigen_pop_len(); |
| 292 |
acpigen_write_return_integer(0); |
| 293 |
} |
| 294 |
acpigen_pop_len(); |
| 295 |
|
| 296 |
|
| 297 |
acpigen_write_if_lequal_namestr_int("CMDT", 2); |
| 298 |
{ |
| 299 |
acpigen_write_if_cond_ref_of("RSTT"); |
| 300 |
{ |
| 301 |
acpigen_write_store(); |
| 302 |
acpigen_emit_namestring("CMDP"); |
| 303 |
acpigen_emit_namestring("RSTT"); |
| 304 |
|
| 305 |
} |
| 306 |
acpigen_pop_len(); |
| 307 |
acpigen_write_return_integer(0); |
| 308 |
} |
| 309 |
acpigen_pop_len(); |
| 310 |
|
| 311 |
|
| 312 |
acpigen_write_if_lequal_namestr_int("CMDT", 3); |
| 313 |
{ |
| 314 |
acpigen_write_if_cond_ref_of("PRRS"); |
| 315 |
{ |
| 316 |
acpigen_write_return_namestr("PRRS"); |
| 317 |
} |
| 318 |
acpigen_pop_len(); |
| 319 |
acpigen_write_return_integer(0); |
| 320 |
} |
| 321 |
acpigen_pop_len(); |
| 322 |
|
| 323 |
acpigen_write_return_integer(0); |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
static void wifi_dsm_set_prr_reset_delay(__always_unused void *args) |
| 330 |
{ |
| 331 |
acpigen_write_if_cond_ref_of("WFDL"); |
| 332 |
{ |
| 333 |
acpigen_write_store(); |
| 334 |
acpigen_emit_byte(ARG3_OP); |
| 335 |
acpigen_emit_namestring("WFDL"); |
| 336 |
} |
| 337 |
acpigen_pop_len(); |
| 338 |
} |
| 339 |
|
| 340 |
static void (*wifi_dsm_callbacks[])(void *) = { |
| 341 |
NULL, |
| 342 |
wifi_dsm_srd_active_channels, |
| 343 |
wifi_dsm_indonasia_5Ghz_band_enable, |
| 344 |
wifi_dsm_supported_ultra_high_band, |
| 345 |
wifi_dsm_regulatory_configurations, |
| 346 |
wifi_dsm_uart_configurations, |
| 347 |
wifi_dsm_ukrane_russia_11ax_enable, |
| 348 |
wifi_dsm_unii4_control_enable, |
| 349 |
NULL, |
| 350 |
NULL, |
| 351 |
wifi_dsm_energy_detection_threshold, |
| 352 |
wifi_dsm_rfi_mitigation, |
| 353 |
wifi_dsm_11be_country_enablement, |
| 354 |
}; |
| 355 |
|
| 356 |
static void (*wifi_dsm2_callbacks[])(void *) = { |
| 357 |
NULL, |
| 358 |
NULL, |
| 359 |
wifi_dsm_power_resource_for_reset, |
| 360 |
wifi_dsm_ddrrfim_func3_cb, |
| 361 |
NULL, |
| 362 |
wifi_dsm_set_prr_reset_delay, |
| 363 |
}; |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
static void bluetooth_dsm_set_power_resource_for_reset(__always_unused void *args) |
| 378 |
{ |
| 379 |
acpigen_write_create_word_field(ARG3_OP, 0, "BCMT"); |
| 380 |
acpigen_write_create_word_field(ARG3_OP, 2, "BCMP"); |
| 381 |
|
| 382 |
|
| 383 |
acpigen_write_if_lequal_namestr_int("BCMT", 1); |
| 384 |
{ |
| 385 |
acpigen_write_if_cond_ref_of("RSTT"); |
| 386 |
{ |
| 387 |
acpigen_write_store(); |
| 388 |
acpigen_emit_namestring("BCMP"); |
| 389 |
acpigen_emit_namestring("RSTT"); |
| 390 |
|
| 391 |
} |
| 392 |
acpigen_pop_len(); |
| 393 |
} |
| 394 |
acpigen_pop_len(); |
| 395 |
|
| 396 |
acpigen_write_return_integer(0); |
| 397 |
} |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
static void bluetooth_dsm_get_power_resource_for_reset(__always_unused void *args) |
| 403 |
{ |
| 404 |
|
| 405 |
acpigen_write_if_cond_ref_of("RSTT"); |
| 406 |
{ |
| 407 |
acpigen_write_if_cond_ref_of("PRRS"); |
| 408 |
{ |
| 409 |
acpigen_emit_byte(RETURN_OP); |
| 410 |
acpigen_write_package(2); |
| 411 |
acpigen_emit_namestring("RSTT"); |
| 412 |
acpigen_emit_namestring("PRRS"); |
| 413 |
acpigen_pop_len(); |
| 414 |
} |
| 415 |
acpigen_pop_len(); |
| 416 |
} |
| 417 |
acpigen_pop_len(); |
| 418 |
|
| 419 |
acpigen_write_return_integer(0); |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
static void bluetooth_dsm_set_prr_reset_delay(__always_unused void *args) |
| 426 |
{ |
| 427 |
acpigen_write_if_cond_ref_of("BTDL"); |
| 428 |
{ |
| 429 |
acpigen_write_store(); |
| 430 |
acpigen_emit_byte(ARG3_OP); |
| 431 |
acpigen_emit_namestring("BTDL"); |
| 432 |
} |
| 433 |
acpigen_pop_len(); |
| 434 |
} |
| 435 |
|
| 436 |
|
| 437 |
static void (*bluetooth_dsm_callbacks[])(void *) = { |
| 438 |
NULL, |
| 439 |
NULL, |
| 440 |
NULL, |
| 441 |
NULL, |
| 442 |
NULL, |
| 443 |
bluetooth_dsm_set_power_resource_for_reset, |
| 444 |
bluetooth_dsm_get_power_resource_for_reset, |
| 445 |
bluetooth_dsm_set_prr_reset_delay, |
| 446 |
}; |
| 447 |
|
| 448 |
static const uint8_t *sar_fetch_set(const struct sar_profile *sar, size_t set_num) |
| 449 |
{ |
| 450 |
const uint8_t *sar_table = &sar->sar_table[0]; |
| 451 |
|
| 452 |
return sar_table + (sar->chains_count * sar->subbands_count * set_num); |
| 453 |
} |
| 454 |
|
| 455 |
static const uint8_t *wgds_fetch_set(struct geo_profile *wgds, size_t set_num) |
| 456 |
{ |
| 457 |
const uint8_t *wgds_table = &wgds->wgds_table[0]; |
| 458 |
|
| 459 |
return wgds_table + (wgds->bands_count * set_num); |
| 460 |
} |
| 461 |
|
| 462 |
static const uint8_t *ppag_fetch_set(struct gain_profile *ppag, size_t set_num) |
| 463 |
{ |
| 464 |
const uint8_t *ppag_table = &ppag->ppag_table[0]; |
| 465 |
|
| 466 |
return ppag_table + (ppag->bands_count * set_num); |
| 467 |
} |
| 468 |
|
| 469 |
static void sar_emit_wrds(const struct sar_profile *sar) |
| 470 |
{ |
| 471 |
int i; |
| 472 |
size_t package_size, table_size; |
| 473 |
const uint8_t *set; |
| 474 |
|
| 475 |
if (sar == NULL) |
| 476 |
return; |
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
if (sar->revision > MAX_SAR_REVISION) { |
| 489 |
printk(BIOS_ERR, "Invalid SAR table revision: %d\n", sar->revision); |
| 490 |
return; |
| 491 |
} |
| 492 |
|
| 493 |
acpigen_write_name("WRDS"); |
| 494 |
acpigen_write_package(2); |
| 495 |
acpigen_write_dword(sar->revision); |
| 496 |
|
| 497 |
table_size = sar->chains_count * sar->subbands_count; |
| 498 |
|
| 499 |
package_size = 1 + 1 + table_size; |
| 500 |
acpigen_write_package(package_size); |
| 501 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 502 |
acpigen_write_dword(1); |
| 503 |
|
| 504 |
set = sar_fetch_set(sar, 0); |
| 505 |
for (i = 0; i < table_size; i++) |
| 506 |
acpigen_write_byte(set[i]); |
| 507 |
|
| 508 |
acpigen_write_package_end(); |
| 509 |
acpigen_write_package_end(); |
| 510 |
} |
| 511 |
|
| 512 |
static void sar_emit_ewrd(const struct sar_profile *sar) |
| 513 |
{ |
| 514 |
int i; |
| 515 |
size_t package_size, set_num, table_size; |
| 516 |
const uint8_t *set; |
| 517 |
|
| 518 |
if (sar == NULL) |
| 519 |
return; |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
if (sar->revision > MAX_SAR_REVISION) { |
| 535 |
printk(BIOS_ERR, "Invalid SAR table revision: %d\n", sar->revision); |
| 536 |
return; |
| 537 |
} |
| 538 |
|
| 539 |
if (sar->dsar_set_count == 0) { |
| 540 |
printk(BIOS_WARNING, "DSAR set count is 0\n"); |
| 541 |
return; |
| 542 |
} |
| 543 |
|
| 544 |
acpigen_write_name("EWRD"); |
| 545 |
acpigen_write_package(2); |
| 546 |
acpigen_write_dword(sar->revision); |
| 547 |
|
| 548 |
table_size = sar->chains_count * sar->subbands_count; |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
package_size = 1 + 1 + 1 + table_size * MAX_DSAR_SET_COUNT; |
| 554 |
acpigen_write_package(package_size); |
| 555 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 556 |
acpigen_write_dword(1); |
| 557 |
acpigen_write_dword(sar->dsar_set_count); |
| 558 |
|
| 559 |
for (set_num = 1; set_num <= sar->dsar_set_count; set_num++) { |
| 560 |
set = sar_fetch_set(sar, set_num); |
| 561 |
for (i = 0; i < table_size; i++) |
| 562 |
acpigen_write_byte(set[i]); |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
for (i = 0; i < (table_size * (MAX_DSAR_SET_COUNT - sar->dsar_set_count)); i++) |
| 567 |
acpigen_write_byte(0); |
| 568 |
|
| 569 |
acpigen_write_package_end(); |
| 570 |
acpigen_write_package_end(); |
| 571 |
} |
| 572 |
|
| 573 |
static void sar_emit_wgds(struct geo_profile *wgds) |
| 574 |
{ |
| 575 |
int i; |
| 576 |
size_t package_size, set_num; |
| 577 |
const uint8_t *set; |
| 578 |
|
| 579 |
if (wgds == NULL) |
| 580 |
return; |
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
if (wgds->revision > MAX_GEO_OFFSET_REVISION) { |
| 618 |
printk(BIOS_ERR, "Invalid WGDS revision: %d\n", wgds->revision); |
| 619 |
return; |
| 620 |
} |
| 621 |
|
| 622 |
package_size = 1 + wgds->chains_count * wgds->bands_count; |
| 623 |
|
| 624 |
acpigen_write_name("WGDS"); |
| 625 |
acpigen_write_package(2); |
| 626 |
acpigen_write_dword(wgds->revision); |
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
acpigen_write_package(package_size); |
| 631 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 632 |
|
| 633 |
for (set_num = 0; set_num < wgds->chains_count; set_num++) { |
| 634 |
set = wgds_fetch_set(wgds, set_num); |
| 635 |
for (i = 0; i < wgds->bands_count; i++) |
| 636 |
acpigen_write_byte(set[i]); |
| 637 |
} |
| 638 |
|
| 639 |
acpigen_write_package_end(); |
| 640 |
acpigen_write_package_end(); |
| 641 |
} |
| 642 |
|
| 643 |
static void sar_emit_ppag(struct gain_profile *ppag) |
| 644 |
{ |
| 645 |
int i; |
| 646 |
size_t package_size, set_num; |
| 647 |
const uint8_t *set; |
| 648 |
|
| 649 |
if (ppag == NULL) |
| 650 |
return; |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
if (ppag->revision > MAX_ANT_GAINS_REVISION) { |
| 664 |
printk(BIOS_ERR, "Invalid PPAG revision: %d\n", ppag->revision); |
| 665 |
return; |
| 666 |
} |
| 667 |
|
| 668 |
package_size = 1 + 1 + ppag->chains_count * ppag->bands_count; |
| 669 |
|
| 670 |
acpigen_write_name("PPAG"); |
| 671 |
acpigen_write_package(2); |
| 672 |
acpigen_write_dword(ppag->revision); |
| 673 |
acpigen_write_package(package_size); |
| 674 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 675 |
acpigen_write_dword(ppag->mode); |
| 676 |
|
| 677 |
for (set_num = 0; set_num < ppag->chains_count; set_num++) { |
| 678 |
set = ppag_fetch_set(ppag, set_num); |
| 679 |
for (i = 0; i < ppag->bands_count; i++) |
| 680 |
acpigen_write_byte(set[i]); |
| 681 |
} |
| 682 |
|
| 683 |
acpigen_write_package_end(); |
| 684 |
acpigen_write_package_end(); |
| 685 |
} |
| 686 |
|
| 687 |
static void sar_emit_wtas(struct avg_profile *wtas) |
| 688 |
{ |
| 689 |
int i; |
| 690 |
size_t package_size; |
| 691 |
|
| 692 |
if (wtas == NULL) |
| 693 |
return; |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
package_size = 1 + 1 + 1 + MAX_DENYLIST_ENTRY; |
| 724 |
|
| 725 |
acpigen_write_name("WTAS"); |
| 726 |
acpigen_write_package(2); |
| 727 |
acpigen_write_dword(wtas->revision); |
| 728 |
acpigen_write_package(package_size); |
| 729 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 730 |
acpigen_write_byte(wtas->tas_selection); |
| 731 |
acpigen_write_byte(wtas->tas_list_size); |
| 732 |
for (i = 0; i < MAX_DENYLIST_ENTRY; i++) |
| 733 |
acpigen_write_word(wtas->deny_list_entry[i]); |
| 734 |
|
| 735 |
acpigen_write_package_end(); |
| 736 |
acpigen_write_package_end(); |
| 737 |
} |
| 738 |
|
| 739 |
static void sar_emit_brds(const struct bsar_profile *bsar) |
| 740 |
{ |
| 741 |
size_t package_size, table_size; |
| 742 |
const uint8_t *set; |
| 743 |
|
| 744 |
if (bsar == NULL) |
| 745 |
return; |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
if (bsar->revision == 0 || bsar->revision > MAX_BSAR_REVISION) { |
| 762 |
printk(BIOS_ERR, "Unsupported BSAR table revision: %d\n", |
| 763 |
bsar->revision); |
| 764 |
return; |
| 765 |
} |
| 766 |
|
| 767 |
acpigen_write_name("BRDS"); |
| 768 |
acpigen_write_package(2); |
| 769 |
acpigen_write_dword(bsar->revision); |
| 770 |
|
| 771 |
if (bsar->revision == 1) |
| 772 |
table_size = sizeof(bsar->revs.rev1); |
| 773 |
else |
| 774 |
table_size = sizeof(bsar->revs.rev2); |
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
package_size = 1 + 1 + 1 + table_size; |
| 781 |
acpigen_write_package(package_size); |
| 782 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 783 |
acpigen_write_dword(1); |
| 784 |
acpigen_write_dword(bsar->increased_power_mode_limitation); |
| 785 |
|
| 786 |
set = (const uint8_t *)&bsar->revs; |
| 787 |
for (int i = 0; i < table_size; i++) |
| 788 |
acpigen_write_byte(set[i]); |
| 789 |
|
| 790 |
acpigen_write_package_end(); |
| 791 |
acpigen_write_package_end(); |
| 792 |
} |
| 793 |
|
| 794 |
static void sar_emit_wbem(const struct wbem_profile *wbem) |
| 795 |
{ |
| 796 |
if (wbem == NULL) |
| 797 |
return; |
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
if (wbem->revision != WBEM_REVISION) { |
| 814 |
printk(BIOS_ERR, "Unsupported WBEM table revision: %d\n", |
| 815 |
wbem->revision); |
| 816 |
return; |
| 817 |
} |
| 818 |
|
| 819 |
acpigen_write_name("WBEM"); |
| 820 |
acpigen_write_package(2); |
| 821 |
acpigen_write_dword(wbem->revision); |
| 822 |
|
| 823 |
acpigen_write_package(2); |
| 824 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 825 |
acpigen_write_dword(wbem->bandwidth_320mhz_country_enablement); |
| 826 |
|
| 827 |
acpigen_write_package_end(); |
| 828 |
acpigen_write_package_end(); |
| 829 |
} |
| 830 |
|
| 831 |
static void sar_emit_bpag(const struct bpag_profile *bpag) |
| 832 |
{ |
| 833 |
if (bpag == NULL) |
| 834 |
return; |
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
if (bpag->revision == 0 || bpag->revision > BPAG_REVISION) { |
| 846 |
printk(BIOS_ERR, "Unsupported BPAG table revision: %d\n", |
| 847 |
bpag->revision); |
| 848 |
return; |
| 849 |
} |
| 850 |
|
| 851 |
acpigen_write_name("BPAG"); |
| 852 |
acpigen_write_package(2); |
| 853 |
acpigen_write_dword(bpag->revision); |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
acpigen_write_package(2); |
| 859 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 860 |
acpigen_write_dword(bpag->antenna_gain_country_enablement); |
| 861 |
|
| 862 |
acpigen_write_package_end(); |
| 863 |
acpigen_write_package_end(); |
| 864 |
} |
| 865 |
|
| 866 |
static void sar_emit_bbfb(const struct bbfb_profile *bbfb) |
| 867 |
{ |
| 868 |
if (bbfb == NULL) |
| 869 |
return; |
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
if (bbfb->revision != BBFB_REVISION) { |
| 881 |
printk(BIOS_ERR, "Unsupported BBFB table revision: %d\n", |
| 882 |
bbfb->revision); |
| 883 |
return; |
| 884 |
} |
| 885 |
|
| 886 |
acpigen_write_name("BBFB"); |
| 887 |
acpigen_write_package(2); |
| 888 |
acpigen_write_dword(bbfb->revision); |
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
acpigen_write_package(2); |
| 894 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 895 |
acpigen_write_dword(bbfb->enable_quad_filter_bypass); |
| 896 |
|
| 897 |
acpigen_write_package_end(); |
| 898 |
acpigen_write_package_end(); |
| 899 |
} |
| 900 |
|
| 901 |
static void sar_emit_bdcm(const struct bdcm_profile *bdcm) |
| 902 |
{ |
| 903 |
if (bdcm == NULL) |
| 904 |
return; |
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
if (bdcm->revision != BDCM_REVISION) { |
| 916 |
printk(BIOS_ERR, "Unsupported BDCM table revision: %d\n", |
| 917 |
bdcm->revision); |
| 918 |
return; |
| 919 |
} |
| 920 |
|
| 921 |
acpigen_write_name("BDCM"); |
| 922 |
acpigen_write_package(2); |
| 923 |
acpigen_write_dword(bdcm->revision); |
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
acpigen_write_package(2); |
| 929 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 930 |
acpigen_write_dword(bdcm->dual_chain_mode); |
| 931 |
|
| 932 |
acpigen_write_package_end(); |
| 933 |
acpigen_write_package_end(); |
| 934 |
} |
| 935 |
|
| 936 |
static void sar_emit_bbsm(const struct bbsm_profile *bbsm) |
| 937 |
{ |
| 938 |
if (bbsm == NULL) |
| 939 |
return; |
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
if (bbsm->revision != BBSM_REVISION) { |
| 951 |
printk(BIOS_ERR, "Unsupported BBSM table revision: %d\n", |
| 952 |
bbsm->revision); |
| 953 |
return; |
| 954 |
} |
| 955 |
|
| 956 |
acpigen_write_name("BBSM"); |
| 957 |
acpigen_write_package(2); |
| 958 |
acpigen_write_dword(bbsm->revision); |
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
acpigen_write_package(2); |
| 964 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 965 |
acpigen_write_dword(bbsm->bands_selection); |
| 966 |
|
| 967 |
acpigen_write_package_end(); |
| 968 |
acpigen_write_package_end(); |
| 969 |
} |
| 970 |
|
| 971 |
static void sar_emit_bucs(const struct bucs_profile *bucs) |
| 972 |
{ |
| 973 |
if (bucs == NULL) |
| 974 |
return; |
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
if (bucs->revision != BUCS_REVISION) { |
| 986 |
printk(BIOS_ERR, "Unsupported BUCS table revision: %d\n", |
| 987 |
bucs->revision); |
| 988 |
return; |
| 989 |
} |
| 990 |
|
| 991 |
acpigen_write_name("BUCS"); |
| 992 |
acpigen_write_package(2); |
| 993 |
acpigen_write_dword(bucs->revision); |
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
acpigen_write_package(2); |
| 999 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 1000 |
acpigen_write_dword(bucs->uhb_country_selection); |
| 1001 |
|
| 1002 |
acpigen_write_package_end(); |
| 1003 |
acpigen_write_package_end(); |
| 1004 |
} |
| 1005 |
|
| 1006 |
static void sar_emit_bdmm(const struct bdmm_profile *bdmm) |
| 1007 |
{ |
| 1008 |
if (bdmm == NULL) |
| 1009 |
return; |
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
if (bdmm->revision != BDMM_REVISION) { |
| 1021 |
printk(BIOS_ERR, "Unsupported BDMM table revision: %d\n", |
| 1022 |
bdmm->revision); |
| 1023 |
return; |
| 1024 |
} |
| 1025 |
|
| 1026 |
acpigen_write_name("BDMM"); |
| 1027 |
acpigen_write_package(2); |
| 1028 |
acpigen_write_dword(bdmm->revision); |
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
acpigen_write_package(2); |
| 1034 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 1035 |
acpigen_write_dword(bdmm->dual_mac_enable); |
| 1036 |
|
| 1037 |
acpigen_write_package_end(); |
| 1038 |
acpigen_write_package_end(); |
| 1039 |
} |
| 1040 |
|
| 1041 |
static void sar_emit_ebrd(const struct ebrd_profile *ebrd) |
| 1042 |
{ |
| 1043 |
if (ebrd == NULL) |
| 1044 |
return; |
| 1045 |
|
| 1046 |
size_t package_size, table_size; |
| 1047 |
const uint8_t *set; |
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
if (ebrd->revision != EBRD_REVISION) { |
| 1061 |
printk(BIOS_ERR, "Unsupported EBRD table revision: %d\n", |
| 1062 |
ebrd->revision); |
| 1063 |
return; |
| 1064 |
} |
| 1065 |
|
| 1066 |
acpigen_write_name("EBRD"); |
| 1067 |
acpigen_write_package(2); |
| 1068 |
acpigen_write_dword(ebrd->revision); |
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
table_size = sizeof(*ebrd) - offsetof(struct ebrd_profile, sar_table_sets); |
| 1075 |
package_size = 1 + 1 + 1 + table_size; |
| 1076 |
acpigen_write_package(package_size); |
| 1077 |
acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); |
| 1078 |
acpigen_write_dword(ebrd->dynamic_sar_enable); |
| 1079 |
acpigen_write_dword(ebrd->number_of_optional_sar); |
| 1080 |
|
| 1081 |
set = (const uint8_t *)&ebrd->sar_table_sets; |
| 1082 |
for (size_t i = 0; i < table_size; i++) |
| 1083 |
acpigen_write_byte(set[i]); |
| 1084 |
|
| 1085 |
acpigen_write_package_end(); |
| 1086 |
acpigen_write_package_end(); |
| 1087 |
} |
| 1088 |
|
| 1089 |
static void sar_emit_wpfc(const struct wpfc_profile *wpfc) |
| 1090 |
{ |
| 1091 |
if (wpfc == NULL) |
| 1092 |
return; |
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
if (wpfc->revision != WPFC_REVISION) { |
| 1109 |
printk(BIOS_ERR, "Unsupported WPFC table revision: %d\n", |
| 1110 |
wpfc->revision); |
| 1111 |
return; |
| 1112 |
} |
| 1113 |
|
| 1114 |
acpigen_write_name("WPFC"); |
| 1115 |
acpigen_write_package(2); |
| 1116 |
acpigen_write_dword(wpfc->revision); |
| 1117 |
|
| 1118 |
acpigen_write_package(5); |
| 1119 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 1120 |
acpigen_write_byte(wpfc->filter_cfg_chain_a); |
| 1121 |
acpigen_write_byte(wpfc->filter_cfg_chain_b); |
| 1122 |
acpigen_write_byte(wpfc->filter_cfg_chain_c); |
| 1123 |
acpigen_write_byte(wpfc->filter_cfg_chain_d); |
| 1124 |
|
| 1125 |
acpigen_write_package_end(); |
| 1126 |
acpigen_write_package_end(); |
| 1127 |
} |
| 1128 |
|
| 1129 |
static void sar_emit_dsbr(const struct dsbr_profile *dsbr, enum sar_domain domain) |
| 1130 |
{ |
| 1131 |
if (dsbr == NULL) |
| 1132 |
return; |
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
|
| 1139 |
|
| 1140 |
|
| 1141 |
|
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
if (dsbr->revision > DSBR_REVISION) { |
| 1146 |
printk(BIOS_ERR, "Unsupported DSBR table revision: %d\n", |
| 1147 |
dsbr->revision); |
| 1148 |
return; |
| 1149 |
} |
| 1150 |
|
| 1151 |
acpigen_write_name("DSBR"); |
| 1152 |
acpigen_write_package(2); |
| 1153 |
acpigen_write_dword(dsbr->revision); |
| 1154 |
|
| 1155 |
acpigen_write_package(2); |
| 1156 |
acpigen_write_dword(domain); |
| 1157 |
acpigen_write_dword(dsbr->bri_resistor_value); |
| 1158 |
|
| 1159 |
acpigen_write_package_end(); |
| 1160 |
acpigen_write_package_end(); |
| 1161 |
} |
| 1162 |
|
| 1163 |
static void emit_wifi_sar_acpi_structures(const struct device *dev, |
| 1164 |
union wifi_sar_limits *sar_limits) |
| 1165 |
{ |
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
if (dev->path.type == DEVICE_PATH_PCI && dev->vendor != PCI_VID_INTEL) |
| 1171 |
return; |
| 1172 |
|
| 1173 |
sar_emit_wrds(sar_limits->sar); |
| 1174 |
sar_emit_ewrd(sar_limits->sar); |
| 1175 |
sar_emit_wgds(sar_limits->wgds); |
| 1176 |
sar_emit_ppag(sar_limits->ppag); |
| 1177 |
sar_emit_wtas(sar_limits->wtas); |
| 1178 |
sar_emit_wbem(sar_limits->wbem); |
| 1179 |
sar_emit_wpfc(sar_limits->wpfc); |
| 1180 |
sar_emit_dsbr(sar_limits->dsbr, DOMAIN_TYPE_WIFI); |
| 1181 |
} |
| 1182 |
|
| 1183 |
static void wifi_ssdt_write_device(const struct device *dev, const char *path) |
| 1184 |
{ |
| 1185 |
|
| 1186 |
acpigen_write_device(path); |
| 1187 |
acpi_device_write_uid(dev); |
| 1188 |
|
| 1189 |
if (dev->chip_ops) |
| 1190 |
acpigen_write_name_string("_DDN", dev->chip_ops->name); |
| 1191 |
|
| 1192 |
|
| 1193 |
acpigen_write_ADR_pci_device(dev); |
| 1194 |
|
| 1195 |
acpigen_pop_len(); |
| 1196 |
} |
| 1197 |
|
| 1198 |
static void wifi_ssdt_write_properties(const struct device *dev, const char *scope) |
| 1199 |
{ |
| 1200 |
const struct drivers_wifi_generic_config *config = dev->chip_info; |
| 1201 |
|
| 1202 |
bool is_cnvi_ddr_rfim_enabled = config && config->enable_cnvi_ddr_rfim; |
| 1203 |
|
| 1204 |
|
| 1205 |
acpigen_write_scope(scope); |
| 1206 |
|
| 1207 |
if (config) { |
| 1208 |
|
| 1209 |
acpigen_write_PRW(config->wake, ACPI_S3); |
| 1210 |
|
| 1211 |
if ((config->add_acpi_dma_property) || (config->cnvi_enable_gpio.pin_count)) { |
| 1212 |
struct acpi_dp *dsd = acpi_dp_new_table("_DSD"); |
| 1213 |
|
| 1214 |
|
| 1215 |
if (config->add_acpi_dma_property) |
| 1216 |
acpi_device_add_dma_property(dsd); |
| 1217 |
|
| 1218 |
if (config->cnvi_enable_gpio.pin_count) |
| 1219 |
acpi_device_add_hotplug_support_in_d3(dsd); |
| 1220 |
|
| 1221 |
acpi_dp_write(dsd); |
| 1222 |
} |
| 1223 |
} |
| 1224 |
|
| 1225 |
|
| 1226 |
if (CONFIG(HAVE_REGULATORY_DOMAIN)) { |
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
| 1236 |
acpigen_write_name("WRDD"); |
| 1237 |
acpigen_write_package(2); |
| 1238 |
acpigen_write_integer(WRDD_REVISION); |
| 1239 |
acpigen_write_package(2); |
| 1240 |
acpigen_write_dword(DOMAIN_TYPE_WIFI); |
| 1241 |
acpigen_write_dword(wifi_regulatory_domain()); |
| 1242 |
acpigen_pop_len(); |
| 1243 |
acpigen_pop_len(); |
| 1244 |
} |
| 1245 |
|
| 1246 |
struct dsm_uuid dsm_ids[MAX_DSM_FUNCS]; |
| 1247 |
|
| 1248 |
|
| 1249 |
union wifi_sar_limits sar_limits = {}; |
| 1250 |
bool sar_loaded = false; |
| 1251 |
if (CONFIG(USE_SAR)) { |
| 1252 |
if (get_wifi_sar_limits(&sar_limits) < 0) |
| 1253 |
printk(BIOS_ERR, "failed getting SAR limits!\n"); |
| 1254 |
else |
| 1255 |
sar_loaded = true; |
| 1256 |
} |
| 1257 |
|
| 1258 |
|
| 1259 |
uint8_t dsm_count = 0; |
| 1260 |
if (sar_loaded) { |
| 1261 |
emit_wifi_sar_acpi_structures(dev, &sar_limits); |
| 1262 |
|
| 1263 |
struct dsm_profile *dsm = sar_limits.dsm; |
| 1264 |
if (dsm && dsm->supported_functions != 0) { |
| 1265 |
for (int i = 1; i < ARRAY_SIZE(wifi_dsm_callbacks); i++) |
| 1266 |
if (!(dsm->supported_functions & (1 << i))) |
| 1267 |
wifi_dsm_callbacks[i] = NULL; |
| 1268 |
|
| 1269 |
dsm_ids[dsm_count].uuid = ACPI_DSM_OEM_WIFI_UUID; |
| 1270 |
dsm_ids[dsm_count].callbacks = &wifi_dsm_callbacks[0]; |
| 1271 |
dsm_ids[dsm_count].count = ARRAY_SIZE(wifi_dsm_callbacks); |
| 1272 |
dsm_ids[dsm_count].arg = dsm; |
| 1273 |
dsm_count++; |
| 1274 |
} |
| 1275 |
} |
| 1276 |
|
| 1277 |
dsm_ids[dsm_count].uuid = ACPI_DSM_RFIM_WIFI_UUID; |
| 1278 |
dsm_ids[dsm_count].callbacks = &wifi_dsm2_callbacks[0]; |
| 1279 |
dsm_ids[dsm_count].count = ARRAY_SIZE(wifi_dsm2_callbacks); |
| 1280 |
dsm_ids[dsm_count].arg = &is_cnvi_ddr_rfim_enabled; |
| 1281 |
dsm_count++; |
| 1282 |
|
| 1283 |
acpigen_write_dsm_uuid_arr(dsm_ids, dsm_count); |
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
if (CONFIG(USE_MTCL)) { |
| 1291 |
if (dev->path.type == DEVICE_PATH_PCI && |
| 1292 |
dev->vendor == PCI_VID_MEDIATEK) |
| 1293 |
write_mtcl_function(); |
| 1294 |
} |
| 1295 |
|
| 1296 |
acpigen_write_scope_end(); |
| 1297 |
|
| 1298 |
|
| 1299 |
if (sar_loaded && is_dev_enabled(config->bluetooth_companion)) { |
| 1300 |
const char *path = acpi_device_path(config->bluetooth_companion); |
| 1301 |
if (path) { |
| 1302 |
acpigen_write_scope(path); |
| 1303 |
sar_emit_brds(sar_limits.bsar); |
| 1304 |
sar_emit_bpag(sar_limits.bpag); |
| 1305 |
sar_emit_bbfb(sar_limits.bbfb); |
| 1306 |
sar_emit_bdcm(sar_limits.bdcm); |
| 1307 |
sar_emit_bbsm(sar_limits.bbsm); |
| 1308 |
sar_emit_bucs(sar_limits.bucs); |
| 1309 |
sar_emit_bdmm(sar_limits.bdmm); |
| 1310 |
sar_emit_ebrd(sar_limits.ebrd); |
| 1311 |
sar_emit_dsbr(sar_limits.dsbr, DOMAIN_TYPE_BLUETOOTH); |
| 1312 |
|
| 1313 |
if (config->bluetooth_companion->path.type == DEVICE_PATH_PCI && |
| 1314 |
config->bluetooth_companion->vendor == PCI_VID_INTEL) { |
| 1315 |
struct dsm_uuid bt_dsm_ids = { |
| 1316 |
.uuid = ACPI_DSM_RFIM_WIFI_UUID, |
| 1317 |
.callbacks = bluetooth_dsm_callbacks, |
| 1318 |
.count = ARRAY_SIZE(bluetooth_dsm_callbacks) |
| 1319 |
}; |
| 1320 |
acpigen_write_dsm_uuid_arr(&bt_dsm_ids, 1); |
| 1321 |
} |
| 1322 |
|
| 1323 |
acpigen_write_scope_end(); |
| 1324 |
} else { |
| 1325 |
printk(BIOS_ERR, "Failed to get %s Bluetooth companion ACPI path\n", |
| 1326 |
dev_path(dev)); |
| 1327 |
} |
| 1328 |
} |
| 1329 |
|
| 1330 |
if (sar_loaded) |
| 1331 |
free(sar_limits.sar); |
| 1332 |
|
| 1333 |
printk(BIOS_INFO, "%s: %s %s\n", scope, dev->chip_ops ? dev->chip_ops->name : "", |
| 1334 |
dev_path(dev)); |
| 1335 |
} |
| 1336 |
|
| 1337 |
void wifi_pcie_fill_ssdt(const struct device *dev) |
| 1338 |
{ |
| 1339 |
const char *path; |
| 1340 |
|
| 1341 |
path = acpi_device_path(dev); |
| 1342 |
if (!path) |
| 1343 |
return; |
| 1344 |
|
| 1345 |
wifi_ssdt_write_device(dev, path); |
| 1346 |
wifi_ssdt_write_properties(dev, path); |
| 1347 |
} |
| 1348 |
|
| 1349 |
const char *wifi_pcie_acpi_name(const struct device *dev) |
| 1350 |
{ |
| 1351 |
static char wifi_acpi_name[WIFI_ACPI_NAME_MAX_LEN]; |
| 1352 |
|
| 1353 |
|
| 1354 |
snprintf(wifi_acpi_name, sizeof(wifi_acpi_name), "WF%02X", |
| 1355 |
(dev_path_encode(dev) & 0xff)); |
| 1356 |
return wifi_acpi_name; |
| 1357 |
} |
| 1358 |
|
| 1359 |
#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI) |
| 1360 |
static void write_cnvi_control(const struct acpi_gpio *gpio) |
| 1361 |
{ |
| 1362 |
|
| 1363 |
acpigen_write_scope("\\_SB.PCI0"); |
| 1364 |
|
| 1365 |
|
| 1366 |
|
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
acpigen_write_method("CNVS", 0); |
| 1375 |
{ |
| 1376 |
acpigen_get_tx_gpio(gpio); |
| 1377 |
acpigen_write_return_op(LOCAL0_OP); |
| 1378 |
} |
| 1379 |
acpigen_pop_len(); |
| 1380 |
|
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
|
| 1386 |
|
| 1387 |
|
| 1388 |
|
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
|
| 1394 |
|
| 1395 |
acpigen_write_method("CNVC", 1); |
| 1396 |
{ |
| 1397 |
acpigen_write_if_lequal_op_int(ARG0_OP, 1); |
| 1398 |
{ |
| 1399 |
acpigen_enable_tx_gpio(gpio); |
| 1400 |
} |
| 1401 |
acpigen_write_else(); |
| 1402 |
{ |
| 1403 |
acpigen_disable_tx_gpio(gpio); |
| 1404 |
} |
| 1405 |
acpigen_pop_len(); |
| 1406 |
} |
| 1407 |
acpigen_pop_len(); |
| 1408 |
|
| 1409 |
acpigen_write_scope_end(); |
| 1410 |
} |
| 1411 |
#endif |
| 1412 |
|
| 1413 |
void wifi_cnvi_fill_ssdt(const struct device *dev) |
| 1414 |
{ |
| 1415 |
const char *path; |
| 1416 |
if (!dev) |
| 1417 |
return; |
| 1418 |
|
| 1419 |
path = acpi_device_path(dev->upstream->dev); |
| 1420 |
if (!path) |
| 1421 |
return; |
| 1422 |
|
| 1423 |
wifi_ssdt_write_properties(dev, path); |
| 1424 |
|
| 1425 |
#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI) |
| 1426 |
const struct drivers_wifi_generic_config *config = dev->chip_info; |
| 1427 |
if (config->cnvi_enable_gpio.pin_count) |
| 1428 |
write_cnvi_control(&config->cnvi_enable_gpio); |
| 1429 |
#endif |
| 1430 |
} |