Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
"The majority of this is an update of the ACPICA kernel code to
upstream revision 20171215 with a cosmetic change and a maintainers
information update on top of it.

The rest is mostly some minor fixes and cleanups in the ACPI drivers
and cleanups to initialization on x86.

Specifics:

- Update the ACPICA kernel code to upstream revision 20171215 including:
* Support for ACPI 6.0A changes in the NFIT table (Bob Moore)
* Local 64-bit divide in string conversions (Bob Moore)
* Fix for a regression in acpi_evaluate_object_type() (Bob Moore)
* Fixes for memory leaks during package object resolution (Bob
Moore)
* Deployment of safe version of strncpy() (Bob Moore)
* Debug and messaging updates (Bob Moore)
* Support for PDTT, SDEV, TPM2 tables in iASL and tools (Bob
Moore)
* Null pointer dereference avoidance in Op and cleanups (Colin Ian
King)
* Fix for memory leak from building prefixed pathname (Erik
Schmauss)
* Coding style fixes, disassembler and compiler updates (Hanjun
Guo, Erik Schmauss)
* Additional PPTT flags from ACPI 6.2 (Jeremy Linton)
* Fix for an off-by-one error in acpi_get_timer_duration()
(Jung-uk Kim)
* Infinite loop detection timeout and utilities cleanups (Lv
Zheng)
* Windows 10 version 1607 and 1703 OSI strings (Mario
Limonciello)

- Update ACPICA information in MAINTAINERS to reflect the current
status of ACPICA maintenance and rename a local variable in one
function to match the corresponding upstream code (Rafael Wysocki)

- Clean up ACPI-related initialization on x86 (Andy Shevchenko)

- Add support for Intel Merrifield to the ACPI GPIO code (Andy
Shevchenko)

- Clean up ACPI PMIC drivers (Andy Shevchenko, Arvind Yadav)

- Fix the ACPI Generic Event Device (GED) driver to free IRQs on
shutdown and clean up the PCI IRQ Link driver (Sinan Kaya)

- Make the GHES code call into the AER driver on all errors and clean
up the ACPI APEI code (Colin Ian King, Tyler Baicar)

- Make the IA64 ACPI NUMA code parse all SRAT entries (Ganapatrao
Kulkarni)

- Add a lid switch blacklist to the ACPI button driver and make it
print extra debug messages on lid events (Hans de Goede)

- Add quirks for Asus GL502VSK and UX305LA to the ACPI battery driver
and clean it up somewhat (Bjørn Mork, Kai-Heng Feng)

- Add device link for CHT SD card dependency on I2C to the ACPI LPSS
(Intel SoCs) driver and make it avoid creating platform device
objects for devices without MMIO resources (Adrian Hunter, Hans de
Goede)

- Fix the ACPI GPE mask kernel command line parameter handling
(Prarit Bhargava)

- Fix the handling of (incorrectly exposed) backlight interfaces
without LCD (Hans de Goede)

- Fix the usage of debugfs_create_*() in the ACPI EC driver (Geert
Uytterhoeven)"

* tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (62 commits)
ACPI/PCI: pci_link: reduce verbosity when IRQ is enabled
ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources
ACPI / PMIC: Convert to use builtin_platform_driver() macro
ACPI / x86: boot: Propagate error code in acpi_gsi_to_irq()
ACPICA: Update version to 20171215
ACPICA: trivial style fix, no functional change
ACPICA: Fix a couple memory leaks during package object resolution
ACPICA: Recognize the Windows 10 version 1607 and 1703 OSI strings
ACPICA: DT compiler: prevent error if optional field at the end of table is not present
ACPICA: Rename a global variable, no functional change
ACPICA: Create and deploy safe version of strncpy
ACPICA: Cleanup the global variables and update comments
ACPICA: Debugger: fix slight indentation issue
ACPICA: Fix a regression in the acpi_evaluate_object_type() interface
ACPICA: Update for a few debug output statements
ACPICA: Debug output, no functional change
ACPI: EC: Fix debugfs_create_*() usage
ACPI / video: Default lcd_only to true on Win8-ready and newer machines
ACPI / x86: boot: Don't setup SCI on HW-reduced platforms
ACPI / x86: boot: Use INVALID_ACPI_IRQ instead of 0 for acpi_sci_override_gsi
...

+1214 -412
-1
Documentation/admin-guide/kernel-parameters.txt
··· 114 114 This facility can be used to prevent such uncontrolled 115 115 GPE floodings. 116 116 Format: <int> 117 - Support masking of GPEs numbered from 0x00 to 0x7f. 118 117 119 118 acpi_no_auto_serialize [HW,ACPI] 120 119 Disable auto-serialization of AML methods
+1 -1
MAINTAINERS
··· 329 329 330 330 ACPI COMPONENT ARCHITECTURE (ACPICA) 331 331 M: Robert Moore <robert.moore@intel.com> 332 - M: Lv Zheng <lv.zheng@intel.com> 332 + M: Erik Schmauss <erik.schmauss@intel.com> 333 333 M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> 334 334 L: linux-acpi@vger.kernel.org 335 335 L: devel@acpica.org
+5
arch/ia64/kernel/acpi.c
··· 504 504 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) 505 505 return -1; 506 506 507 + if (num_node_memblks >= NR_NODE_MEMBLKS) { 508 + pr_err("NUMA: too many memblk ranges\n"); 509 + return -EINVAL; 510 + } 511 + 507 512 /* record this node in proximity bitmap */ 508 513 pxm_bit_set(pxm); 509 514
+1 -1
arch/x86/include/asm/acpi.h
··· 49 49 extern int acpi_disable_cmcff; 50 50 51 51 extern u8 acpi_sci_flags; 52 - extern int acpi_sci_override_gsi; 52 + extern u32 acpi_sci_override_gsi; 53 53 void acpi_pic_sci_set_trigger(unsigned int, u16); 54 54 55 55 struct device;
+17 -18
arch/x86/kernel/acpi/boot.c
··· 68 68 int acpi_strict; 69 69 int acpi_disable_cmcff; 70 70 71 + /* ACPI SCI override configuration */ 71 72 u8 acpi_sci_flags __initdata; 72 - int acpi_sci_override_gsi __initdata; 73 + u32 acpi_sci_override_gsi __initdata = INVALID_ACPI_IRQ; 73 74 int acpi_skip_timer_override __initdata; 74 75 int acpi_use_timer_override __initdata; 75 76 int acpi_fix_pin2_polarity __initdata; ··· 112 111 static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { 113 112 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 114 113 }; 115 - 116 - #define ACPI_INVALID_GSI INT_MIN 117 114 118 115 /* 119 116 * This is just a simple wrapper around early_memremap(), ··· 371 372 * and acpi_isa_irq_to_gsi() may give wrong result. 372 373 */ 373 374 if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi) 374 - isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI; 375 + isa_irq_to_gsi[gsi] = INVALID_ACPI_IRQ; 375 376 isa_irq_to_gsi[bus_irq] = gsi; 376 377 } 377 378 ··· 619 620 } 620 621 621 622 rc = acpi_get_override_irq(gsi, &trigger, &polarity); 622 - if (rc == 0) { 623 - trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; 624 - polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; 625 - irq = acpi_register_gsi(NULL, gsi, trigger, polarity); 626 - if (irq >= 0) { 627 - *irqp = irq; 628 - return 0; 629 - } 630 - } 623 + if (rc) 624 + return rc; 631 625 632 - return -1; 626 + trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; 627 + polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; 628 + irq = acpi_register_gsi(NULL, gsi, trigger, polarity); 629 + if (irq < 0) 630 + return irq; 631 + 632 + *irqp = irq; 633 + return 0; 633 634 } 634 635 EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); 635 636 636 637 int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) 637 638 { 638 639 if (isa_irq < nr_legacy_irqs() && 639 - isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) { 640 + isa_irq_to_gsi[isa_irq] != INVALID_ACPI_IRQ) { 640 641 *gsi = isa_irq_to_gsi[isa_irq]; 641 642 return 0; 642 643 } ··· 675 676 mutex_lock(&acpi_ioapic_lock); 676 677 irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info); 677 678 /* Don't set up the ACPI SCI because it's already set up */ 678 - if (irq >= 0 && enable_update_mptable && 679 - acpi_gbl_FADT.sci_interrupt != gsi) 679 + if (irq >= 0 && enable_update_mptable && gsi != acpi_gbl_FADT.sci_interrupt) 680 680 mp_config_acpi_gsi(dev, gsi, trigger, polarity); 681 681 mutex_unlock(&acpi_ioapic_lock); 682 682 #endif ··· 1209 1211 /* 1210 1212 * If BIOS did not supply an INT_SRC_OVR for the SCI 1211 1213 * pretend we got one so we can set the SCI flags. 1214 + * But ignore setting up SCI on hardware reduced platforms. 1212 1215 */ 1213 - if (!acpi_sci_override_gsi) 1216 + if (acpi_sci_override_gsi == INVALID_ACPI_IRQ && !acpi_gbl_reduced_hardware) 1214 1217 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0, 1215 1218 acpi_gbl_FADT.sci_interrupt); 1216 1219
+139
drivers/acpi/acpi_lpss.c
··· 427 427 return 0; 428 428 } 429 429 430 + struct lpss_device_links { 431 + const char *supplier_hid; 432 + const char *supplier_uid; 433 + const char *consumer_hid; 434 + const char *consumer_uid; 435 + u32 flags; 436 + }; 437 + 438 + /* 439 + * The _DEP method is used to identify dependencies but instead of creating 440 + * device links for every handle in _DEP, only links in the following list are 441 + * created. That is necessary because, in the general case, _DEP can refer to 442 + * devices that might not have drivers, or that are on different buses, or where 443 + * the supplier is not enumerated until after the consumer is probed. 444 + */ 445 + static const struct lpss_device_links lpss_device_links[] = { 446 + {"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME}, 447 + }; 448 + 449 + static bool hid_uid_match(const char *hid1, const char *uid1, 450 + const char *hid2, const char *uid2) 451 + { 452 + return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2); 453 + } 454 + 455 + static bool acpi_lpss_is_supplier(struct acpi_device *adev, 456 + const struct lpss_device_links *link) 457 + { 458 + return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev), 459 + link->supplier_hid, link->supplier_uid); 460 + } 461 + 462 + static bool acpi_lpss_is_consumer(struct acpi_device *adev, 463 + const struct lpss_device_links *link) 464 + { 465 + return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev), 466 + link->consumer_hid, link->consumer_uid); 467 + } 468 + 469 + struct hid_uid { 470 + const char *hid; 471 + const char *uid; 472 + }; 473 + 474 + static int match_hid_uid(struct device *dev, void *data) 475 + { 476 + struct acpi_device *adev = ACPI_COMPANION(dev); 477 + struct hid_uid *id = data; 478 + 479 + if (!adev) 480 + return 0; 481 + 482 + return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev), 483 + id->hid, id->uid); 484 + } 485 + 486 + static struct device *acpi_lpss_find_device(const char *hid, const char *uid) 487 + { 488 + struct hid_uid data = { 489 + .hid = hid, 490 + .uid = uid, 491 + }; 492 + 493 + return bus_find_device(&platform_bus_type, NULL, &data, match_hid_uid); 494 + } 495 + 496 + static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle) 497 + { 498 + struct acpi_handle_list dep_devices; 499 + acpi_status status; 500 + int i; 501 + 502 + if (!acpi_has_method(adev->handle, "_DEP")) 503 + return false; 504 + 505 + status = acpi_evaluate_reference(adev->handle, "_DEP", NULL, 506 + &dep_devices); 507 + if (ACPI_FAILURE(status)) { 508 + dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n"); 509 + return false; 510 + } 511 + 512 + for (i = 0; i < dep_devices.count; i++) { 513 + if (dep_devices.handles[i] == handle) 514 + return true; 515 + } 516 + 517 + return false; 518 + } 519 + 520 + static void acpi_lpss_link_consumer(struct device *dev1, 521 + const struct lpss_device_links *link) 522 + { 523 + struct device *dev2; 524 + 525 + dev2 = acpi_lpss_find_device(link->consumer_hid, link->consumer_uid); 526 + if (!dev2) 527 + return; 528 + 529 + if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1))) 530 + device_link_add(dev2, dev1, link->flags); 531 + 532 + put_device(dev2); 533 + } 534 + 535 + static void acpi_lpss_link_supplier(struct device *dev1, 536 + const struct lpss_device_links *link) 537 + { 538 + struct device *dev2; 539 + 540 + dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid); 541 + if (!dev2) 542 + return; 543 + 544 + if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2))) 545 + device_link_add(dev1, dev2, link->flags); 546 + 547 + put_device(dev2); 548 + } 549 + 550 + static void acpi_lpss_create_device_links(struct acpi_device *adev, 551 + struct platform_device *pdev) 552 + { 553 + int i; 554 + 555 + for (i = 0; i < ARRAY_SIZE(lpss_device_links); i++) { 556 + const struct lpss_device_links *link = &lpss_device_links[i]; 557 + 558 + if (acpi_lpss_is_supplier(adev, link)) 559 + acpi_lpss_link_consumer(&pdev->dev, link); 560 + 561 + if (acpi_lpss_is_consumer(adev, link)) 562 + acpi_lpss_link_supplier(&pdev->dev, link); 563 + } 564 + } 565 + 430 566 static int acpi_lpss_create_device(struct acpi_device *adev, 431 567 const struct acpi_device_id *id) 432 568 { ··· 601 465 acpi_dev_free_resource_list(&resource_list); 602 466 603 467 if (!pdata->mmio_base) { 468 + /* Avoid acpi_bus_attach() instantiating a pdev for this dev. */ 469 + adev->pnp.type.platform_id = 0; 604 470 /* Skip the device, but continue the namespace scan. */ 605 471 ret = 0; 606 472 goto err_out; ··· 638 500 adev->driver_data = pdata; 639 501 pdev = acpi_create_platform_device(adev, dev_desc->properties); 640 502 if (!IS_ERR_OR_NULL(pdev)) { 503 + acpi_lpss_create_device_links(adev, pdev); 641 504 return 1; 642 505 } 643 506
+12 -2
drivers/acpi/acpi_video.c
··· 80 80 static bool device_id_scheme = false; 81 81 module_param(device_id_scheme, bool, 0444); 82 82 83 - static bool only_lcd = false; 84 - module_param(only_lcd, bool, 0444); 83 + static int only_lcd = -1; 84 + module_param(only_lcd, int, 0444); 85 85 86 86 static int register_count; 87 87 static DEFINE_MUTEX(register_count_mutex); ··· 2135 2135 */ 2136 2136 goto leave; 2137 2137 } 2138 + 2139 + /* 2140 + * We're seeing a lot of bogus backlight interfaces on newer machines 2141 + * without a LCD such as desktops, servers and HDMI sticks. Checking 2142 + * the lcd flag fixes this, so enable this on any machines which are 2143 + * win8 ready (where we also prefer the native backlight driver, so 2144 + * normally the acpi_video code should not register there anyways). 2145 + */ 2146 + if (only_lcd == -1) 2147 + only_lcd = acpi_osi_is_win8(); 2138 2148 2139 2149 dmi_check_system(video_dmi_table); 2140 2150
+3
drivers/acpi/acpica/acapps.h
··· 80 80 prefix, ACPICA_COPYRIGHT, \ 81 81 prefix 82 82 83 + #define ACPI_COMMON_BUILD_TIME \ 84 + "Build date/time: %s %s\n", __DATE__, __TIME__ 85 + 83 86 /* Macros for usage messages */ 84 87 85 88 #define ACPI_USAGE_HEADER(usage) \
+4
drivers/acpi/acpica/acdebug.h
··· 223 223 acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags); 224 224 225 225 void 226 + acpi_db_create_execution_thread(char *method_name_arg, 227 + char **arguments, acpi_object_type *types); 228 + 229 + void 226 230 acpi_db_create_execution_threads(char *num_threads_arg, 227 231 char *num_loops_arg, char *method_name_arg); 228 232
+27 -55
drivers/acpi/acpica/acglobal.h
··· 46 46 47 47 /***************************************************************************** 48 48 * 49 - * Globals related to the ACPI tables 49 + * Globals related to the incoming ACPI tables 50 50 * 51 51 ****************************************************************************/ 52 52 ··· 87 87 88 88 /***************************************************************************** 89 89 * 90 - * Mutual exclusion within ACPICA subsystem 90 + * Mutual exclusion within the ACPICA subsystem 91 91 * 92 92 ****************************************************************************/ 93 93 ··· 167 167 168 168 ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE); 169 169 170 - /* Misc */ 170 + /* Miscellaneous */ 171 171 172 172 ACPI_GLOBAL(u32, acpi_gbl_original_mode); 173 173 ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count); ··· 191 191 extern const char acpi_gbl_upper_hex_digits[]; 192 192 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 193 193 194 - #ifdef ACPI_DBG_TRACK_ALLOCATIONS 195 - 196 194 /* Lists for tracking memory allocations (debug only) */ 197 195 196 + #ifdef ACPI_DBG_TRACK_ALLOCATIONS 198 197 ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list); 199 198 ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list); 200 199 ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats); ··· 202 203 203 204 /***************************************************************************** 204 205 * 205 - * Namespace globals 206 + * ACPI Namespace 206 207 * 207 208 ****************************************************************************/ 208 209 ··· 233 234 234 235 /***************************************************************************** 235 236 * 236 - * Interpreter globals 237 + * Interpreter/Parser globals 237 238 * 238 239 ****************************************************************************/ 239 - 240 - ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list); 241 240 242 241 /* Control method single step flag */ 243 242 244 243 ACPI_GLOBAL(u8, acpi_gbl_cm_single_step); 244 + ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list); 245 + ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL); 246 + 247 + /* ASL/ASL+ converter */ 248 + 249 + ACPI_INIT_GLOBAL(u8, acpi_gbl_capture_comments, FALSE); 250 + ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL); 245 251 246 252 /***************************************************************************** 247 253 * ··· 256 252 257 253 extern struct acpi_bit_register_info 258 254 acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; 259 - 260 255 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); 261 256 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); 262 257 ··· 266 263 ****************************************************************************/ 267 264 268 265 #if (!ACPI_REDUCED_HARDWARE) 269 - 270 266 ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized); 271 267 ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head); 272 268 ACPI_GLOBAL(struct acpi_gpe_block_info *, ··· 274 272 ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context); 275 273 ACPI_GLOBAL(struct acpi_fixed_event_handler, 276 274 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]); 277 - 278 275 extern struct acpi_fixed_event_info 279 276 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; 280 - 281 277 #endif /* !ACPI_REDUCED_HARDWARE */ 282 278 283 279 /***************************************************************************** ··· 291 291 ACPI_GLOBAL(u32, acpi_sci_count); 292 292 ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]); 293 293 294 - /* Support for dynamic control method tracing mechanism */ 294 + /* Dynamic control method tracing mechanism */ 295 295 296 296 ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level); 297 297 ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer); 298 298 299 299 /***************************************************************************** 300 300 * 301 - * Debugger and Disassembler globals 301 + * Debugger and Disassembler 302 302 * 303 303 ****************************************************************************/ 304 304 ··· 326 326 #endif 327 327 328 328 #ifdef ACPI_DEBUGGER 329 - 330 329 ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); 331 330 ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); 332 331 ··· 339 340 ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node); 340 341 ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop); 341 342 ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated); 342 - 343 343 ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]); 344 344 ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); 345 345 ··· 348 350 ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); 349 351 ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); 350 352 351 - /* 352 - * Statistic globals 353 - */ 353 + /* Statistics globals */ 354 + 354 355 ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]); 355 356 ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]); 356 357 ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc); 357 358 ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); 358 359 ACPI_GLOBAL(u32, acpi_gbl_num_nodes); 359 360 ACPI_GLOBAL(u32, acpi_gbl_num_objects); 360 - 361 361 #endif /* ACPI_DEBUGGER */ 362 362 363 363 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) 364 - 365 364 ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]); 366 365 ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]); 367 366 ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]); 368 367 ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]); 369 - 370 368 ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE); 371 - 372 369 #endif 373 370 374 - /* 375 - * Meant for the -ca option. 376 - */ 371 + /***************************************************************************** 372 + * 373 + * ACPICA application-specific globals 374 + * 375 + ****************************************************************************/ 376 + 377 + /* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ 378 + 379 + #ifdef ACPI_ASL_COMPILER 377 380 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL); 378 381 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL); 379 382 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL); ··· 385 386 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL); 386 387 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL); 387 388 388 - ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL); 389 - 390 389 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head, 391 390 NULL); 392 391 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail, 393 392 NULL); 394 - 395 393 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head, 396 394 NULL); 397 395 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail, 398 396 NULL); 399 - 400 397 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head, 401 398 NULL); 402 399 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail, 403 400 NULL); 404 - 405 401 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head, 406 402 NULL); 407 403 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail, ··· 404 410 405 411 ACPI_INIT_GLOBAL(struct acpi_comment_addr_node, 406 412 *acpi_gbl_comment_addr_list_head, NULL); 407 - 408 - ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL); 409 - 410 413 ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL); 411 414 412 415 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache); 413 416 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache); 414 417 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache); 415 418 416 - ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE); 417 - 418 419 ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE); 419 420 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL); 420 - 421 421 ACPI_GLOBAL(char, acpi_gbl_table_sig[4]); 422 - 423 - /***************************************************************************** 424 - * 425 - * Application globals 426 - * 427 - ****************************************************************************/ 422 + #endif 428 423 429 424 #ifdef ACPI_APPLICATION 430 - 431 425 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); 432 426 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL); 433 427 ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE); ··· 424 442 425 443 ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */ 426 444 ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]); 427 - 428 445 #endif /* ACPI_APPLICATION */ 429 - 430 - /***************************************************************************** 431 - * 432 - * Info/help support 433 - * 434 - ****************************************************************************/ 435 - 436 - extern const struct ah_predefined_name asl_predefined_info[]; 437 - extern const struct ah_device_id asl_device_ids[]; 438 446 439 447 #endif /* __ACGLOBAL_H__ */
+8 -7
drivers/acpi/acpica/aclocal.h
··· 622 622 union acpi_parse_object *predicate_op; 623 623 u8 *aml_predicate_start; /* Start of if/while predicate */ 624 624 u8 *package_end; /* End of if/while block */ 625 - u32 loop_count; /* While() loop counter */ 625 + u64 loop_timeout; /* While() loop timeout */ 626 626 }; 627 627 628 628 /* ··· 1218 1218 acpi_object_type *types; 1219 1219 1220 1220 /* 1221 - * Arguments to be passed to method for the command 1222 - * Threads - 1223 - * the Number of threads, ID of current thread and 1224 - * Index of current thread inside all them created. 1221 + * Arguments to be passed to method for the commands Threads and 1222 + * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6). 1223 + * 1224 + * For the Threads command, the Number of threads, ID of current 1225 + * thread and Index of current thread inside all them created. 1225 1226 */ 1226 1227 char init_args; 1227 1228 #ifdef ACPI_DEBUGGER 1228 - acpi_object_type arg_types[4]; 1229 + acpi_object_type arg_types[ACPI_METHOD_NUM_ARGS]; 1229 1230 #endif 1230 - char *arguments[4]; 1231 + char *arguments[ACPI_METHOD_NUM_ARGS]; 1231 1232 char num_threads_str[11]; 1232 1233 char id_of_thread_str[11]; 1233 1234 char index_of_thread_str[11];
+1 -1
drivers/acpi/acpica/acmacros.h
··· 455 455 * the plist contains a set of parens to allow variable-length lists. 456 456 * These macros are used for both the debug and non-debug versions of the code. 457 457 */ 458 - #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); 458 + #define ACPI_ERROR_NAMESPACE(s, p, e) acpi_ut_prefixed_namespace_error (AE_INFO, s, p, e); 459 459 #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); 460 460 #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 461 461 #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
+3
drivers/acpi/acpica/acnamesp.h
··· 289 289 char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, 290 290 u8 no_trailing); 291 291 292 + char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope, 293 + const char *internal_path); 294 + 292 295 char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); 293 296 294 297 acpi_status
+12 -11
drivers/acpi/acpica/acutils.h
··· 118 118 #ifndef ACPI_MSG_ERROR 119 119 #define ACPI_MSG_ERROR "ACPI Error: " 120 120 #endif 121 - #ifndef ACPI_MSG_EXCEPTION 122 - #define ACPI_MSG_EXCEPTION "ACPI Exception: " 123 - #endif 124 121 #ifndef ACPI_MSG_WARNING 125 122 #define ACPI_MSG_WARNING "ACPI Warning: " 126 123 #endif ··· 126 129 #endif 127 130 128 131 #ifndef ACPI_MSG_BIOS_ERROR 129 - #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " 132 + #define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): " 130 133 #endif 131 134 #ifndef ACPI_MSG_BIOS_WARNING 132 - #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " 135 + #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): " 133 136 #endif 134 137 135 138 /* ··· 230 233 */ 231 234 acpi_status acpi_ut_init_globals(void); 232 235 233 - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 234 - 235 236 const char *acpi_ut_get_mutex_name(u32 mutex_id); 237 + 238 + #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 236 239 237 240 const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); 238 241 #endif ··· 638 641 639 642 void acpi_ut_repair_name(char *name); 640 643 641 - #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 644 + #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT) 642 645 u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source); 646 + 647 + void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size); 643 648 644 649 u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source); 645 650 ··· 736 737 u8 node_flags, const char *format, ...); 737 738 738 739 void 739 - acpi_ut_namespace_error(const char *module_name, 740 - u32 line_number, 741 - const char *internal_name, acpi_status lookup_status); 740 + acpi_ut_prefixed_namespace_error(const char *module_name, 741 + u32 line_number, 742 + union acpi_generic_state *prefix_scope, 743 + const char *internal_name, 744 + acpi_status lookup_status); 742 745 743 746 void 744 747 acpi_ut_method_error(const char *module_name,
+109 -1
drivers/acpi/acpica/dbexec.c
··· 67 67 acpi_db_execution_walk(acpi_handle obj_handle, 68 68 u32 nesting_level, void *context, void **return_value); 69 69 70 + static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context); 71 + 70 72 /******************************************************************************* 71 73 * 72 74 * FUNCTION: acpi_db_delete_objects ··· 231 229 232 230 ACPI_FUNCTION_NAME(db_execute_setup); 233 231 234 - /* Catenate the current scope to the supplied name */ 232 + /* Concatenate the current scope to the supplied name */ 235 233 236 234 info->pathname[0] = 0; 237 235 if ((info->name[0] != '\\') && (info->name[0] != '/')) { ··· 609 607 acpi_format_exception(status)); 610 608 } 611 609 } 610 + } 611 + 612 + /******************************************************************************* 613 + * 614 + * FUNCTION: acpi_db_single_execution_thread 615 + * 616 + * PARAMETERS: context - Method info struct 617 + * 618 + * RETURN: None 619 + * 620 + * DESCRIPTION: Create one thread and execute a method 621 + * 622 + ******************************************************************************/ 623 + 624 + static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context) 625 + { 626 + struct acpi_db_method_info *info = context; 627 + acpi_status status; 628 + struct acpi_buffer return_obj; 629 + 630 + acpi_os_printf("\n"); 631 + 632 + status = acpi_db_execute_method(info, &return_obj); 633 + if (ACPI_FAILURE(status)) { 634 + acpi_os_printf("%s During evaluation of %s\n", 635 + acpi_format_exception(status), info->pathname); 636 + return; 637 + } 638 + 639 + /* Display a return object, if any */ 640 + 641 + if (return_obj.length) { 642 + acpi_os_printf("Evaluation of %s returned object %p, " 643 + "external buffer length %X\n", 644 + acpi_gbl_db_method_info.pathname, 645 + return_obj.pointer, (u32)return_obj.length); 646 + 647 + acpi_db_dump_external_object(return_obj.pointer, 1); 648 + } 649 + 650 + acpi_os_printf("\nBackground thread completed\n%c ", 651 + ACPI_DEBUGGER_COMMAND_PROMPT); 652 + } 653 + 654 + /******************************************************************************* 655 + * 656 + * FUNCTION: acpi_db_create_execution_thread 657 + * 658 + * PARAMETERS: method_name_arg - Control method to execute 659 + * arguments - Array of arguments to the method 660 + * types - Corresponding array of object types 661 + * 662 + * RETURN: None 663 + * 664 + * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles 665 + * arguments passed on command line for control methods. 666 + * 667 + ******************************************************************************/ 668 + 669 + void 670 + acpi_db_create_execution_thread(char *method_name_arg, 671 + char **arguments, acpi_object_type *types) 672 + { 673 + acpi_status status; 674 + u32 i; 675 + 676 + memset(&acpi_gbl_db_method_info, 0, sizeof(struct acpi_db_method_info)); 677 + acpi_gbl_db_method_info.name = method_name_arg; 678 + acpi_gbl_db_method_info.init_args = 1; 679 + acpi_gbl_db_method_info.args = acpi_gbl_db_method_info.arguments; 680 + acpi_gbl_db_method_info.types = acpi_gbl_db_method_info.arg_types; 681 + 682 + /* Setup method arguments, up to 7 (0-6) */ 683 + 684 + for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *arguments; i++) { 685 + acpi_gbl_db_method_info.arguments[i] = *arguments; 686 + arguments++; 687 + 688 + acpi_gbl_db_method_info.arg_types[i] = *types; 689 + types++; 690 + } 691 + 692 + status = acpi_db_execute_setup(&acpi_gbl_db_method_info); 693 + if (ACPI_FAILURE(status)) { 694 + return; 695 + } 696 + 697 + /* Get the NS node, determines existence also */ 698 + 699 + status = acpi_get_handle(NULL, acpi_gbl_db_method_info.pathname, 700 + &acpi_gbl_db_method_info.method); 701 + if (ACPI_FAILURE(status)) { 702 + acpi_os_printf("%s Could not get handle for %s\n", 703 + acpi_format_exception(status), 704 + acpi_gbl_db_method_info.pathname); 705 + return; 706 + } 707 + 708 + status = acpi_os_execute(OSL_DEBUGGER_EXEC_THREAD, 709 + acpi_db_single_execution_thread, 710 + &acpi_gbl_db_method_info); 711 + if (ACPI_FAILURE(status)) { 712 + return; 713 + } 714 + 715 + acpi_os_printf("\nBackground thread started\n"); 612 716 } 613 717 614 718 /*******************************************************************************
+2 -2
drivers/acpi/acpica/dbfileio.c
··· 99 99 } 100 100 101 101 acpi_os_printf("Debug output file %s opened\n", name); 102 - strncpy(acpi_gbl_db_debug_filename, name, 103 - sizeof(acpi_gbl_db_debug_filename)); 102 + acpi_ut_safe_strncpy(acpi_gbl_db_debug_filename, name, 103 + sizeof(acpi_gbl_db_debug_filename)); 104 104 acpi_gbl_db_output_to_file = TRUE; 105 105 } 106 106 #endif
+90 -63
drivers/acpi/acpica/dbinput.c
··· 136 136 CMD_UNLOAD, 137 137 138 138 CMD_TERMINATE, 139 + CMD_BACKGROUND, 139 140 CMD_THREADS, 140 141 141 142 CMD_TEST, ··· 213 212 {"UNLOAD", 1}, 214 213 215 214 {"TERMINATE", 0}, 215 + {"BACKGROUND", 1}, 216 216 {"THREADS", 3}, 217 217 218 218 {"TEST", 1}, ··· 224 222 /* 225 223 * Help for all debugger commands. First argument is the number of lines 226 224 * of help to output for the command. 225 + * 226 + * Note: Some commands are not supported by the kernel-level version of 227 + * the debugger. 227 228 */ 228 229 static const struct acpi_db_command_help acpi_gbl_db_command_help[] = { 229 - {0, "\nGeneral-Purpose Commands:", "\n"}, 230 - {1, " Allocations", "Display list of current memory allocations\n"}, 231 - {2, " Dump <Address>|<Namepath>", "\n"}, 232 - {0, " [Byte|Word|Dword|Qword]", 233 - "Display ACPI objects or memory\n"}, 234 - {1, " Handlers", "Info about global handlers\n"}, 235 - {1, " Help [Command]", "This help screen or individual command\n"}, 236 - {1, " History", "Display command history buffer\n"}, 237 - {1, " Level <DebugLevel>] [console]", 238 - "Get/Set debug level for file or console\n"}, 239 - {1, " Locks", "Current status of internal mutexes\n"}, 240 - {1, " Osi [Install|Remove <name>]", 241 - "Display or modify global _OSI list\n"}, 242 - {1, " Quit or Exit", "Exit this command\n"}, 243 - {8, " Stats <SubCommand>", 244 - "Display namespace and memory statistics\n"}, 245 - {1, " Allocations", "Display list of current memory allocations\n"}, 246 - {1, " Memory", "Dump internal memory lists\n"}, 247 - {1, " Misc", "Namespace search and mutex stats\n"}, 248 - {1, " Objects", "Summary of namespace objects\n"}, 249 - {1, " Sizes", "Sizes for each of the internal objects\n"}, 250 - {1, " Stack", "Display CPU stack usage\n"}, 251 - {1, " Tables", "Info about current ACPI table(s)\n"}, 252 - {1, " Tables", "Display info about loaded ACPI tables\n"}, 253 - {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, 254 - {1, " !!", "Execute last command again\n"}, 255 - 256 - {0, "\nNamespace Access Commands:", "\n"}, 230 + {0, "\nNamespace Access:", "\n"}, 257 231 {1, " Businfo", "Display system bus info\n"}, 258 232 {1, " Disassemble <Method>", "Disassemble a control method\n"}, 259 233 {1, " Find <AcpiName> (? is wildcard)", ··· 253 275 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, 254 276 {1, " Type <Object>", "Display object type\n"}, 255 277 256 - {0, "\nControl Method Execution Commands:", "\n"}, 278 + {0, "\nControl Method Execution:", "\n"}, 279 + {1, " Evaluate <Namepath> [Arguments]", 280 + "Evaluate object or control method\n"}, 281 + {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"}, 282 + #ifdef ACPI_APPLICATION 283 + {1, " Background <Namepath> [Arguments]", 284 + "Evaluate object/method in a separate thread\n"}, 285 + {1, " Thread <Threads><Loops><NamePath>", 286 + "Spawn threads to execute method(s)\n"}, 287 + #endif 288 + {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"}, 289 + {7, " [Arguments] formats:", "Control method argument formats\n"}, 290 + {1, " Hex Integer", "Integer\n"}, 291 + {1, " \"Ascii String\"", "String\n"}, 292 + {1, " (Hex Byte List)", "Buffer\n"}, 293 + {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"}, 294 + {1, " [Package Element List]", "Package\n"}, 295 + {1, " [0x01 0x1234 \"string\"]", 296 + "Package example (3 elements)\n"}, 297 + 298 + {0, "\nMiscellaneous:", "\n"}, 299 + {1, " Allocations", "Display list of current memory allocations\n"}, 300 + {2, " Dump <Address>|<Namepath>", "\n"}, 301 + {0, " [Byte|Word|Dword|Qword]", 302 + "Display ACPI objects or memory\n"}, 303 + {1, " Handlers", "Info about global handlers\n"}, 304 + {1, " Help [Command]", "This help screen or individual command\n"}, 305 + {1, " History", "Display command history buffer\n"}, 306 + {1, " Level <DebugLevel>] [console]", 307 + "Get/Set debug level for file or console\n"}, 308 + {1, " Locks", "Current status of internal mutexes\n"}, 309 + {1, " Osi [Install|Remove <name>]", 310 + "Display or modify global _OSI list\n"}, 311 + {1, " Quit or Exit", "Exit this command\n"}, 312 + {8, " Stats <SubCommand>", 313 + "Display namespace and memory statistics\n"}, 314 + {1, " Allocations", "Display list of current memory allocations\n"}, 315 + {1, " Memory", "Dump internal memory lists\n"}, 316 + {1, " Misc", "Namespace search and mutex stats\n"}, 317 + {1, " Objects", "Summary of namespace objects\n"}, 318 + {1, " Sizes", "Sizes for each of the internal objects\n"}, 319 + {1, " Stack", "Display CPU stack usage\n"}, 320 + {1, " Tables", "Info about current ACPI table(s)\n"}, 321 + {1, " Tables", "Display info about loaded ACPI tables\n"}, 322 + #ifdef ACPI_APPLICATION 323 + {1, " Terminate", "Delete namespace and all internal objects\n"}, 324 + #endif 325 + {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, 326 + {1, " !!", "Execute last command again\n"}, 327 + 328 + {0, "\nMethod and Namespace Debugging:", "\n"}, 329 + {5, " Trace <State> [<Namepath>] [Once]", 330 + "Trace control method execution\n"}, 331 + {1, " Enable", "Enable all messages\n"}, 332 + {1, " Disable", "Disable tracing\n"}, 333 + {1, " Method", "Enable method execution messages\n"}, 334 + {1, " Opcode", "Enable opcode execution messages\n"}, 335 + {3, " Test <TestName>", "Invoke a debug test\n"}, 336 + {1, " Objects", "Read/write/compare all namespace data objects\n"}, 337 + {1, " Predefined", 338 + "Validate all ACPI predefined names (_STA, etc.)\n"}, 339 + {1, " Execute predefined", 340 + "Execute all predefined (public) methods\n"}, 341 + 342 + {0, "\nControl Method Single-Step Execution:", "\n"}, 257 343 {1, " Arguments (or Args)", "Display method arguments\n"}, 258 344 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, 259 345 {1, " Call", "Run to next control method invocation\n"}, 260 - {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"}, 261 - {6, " Evaluate", "Synonym for Execute\n"}, 262 - {5, " Execute <Namepath> [Arguments]", "Execute control method\n"}, 263 - {1, " Hex Integer", "Integer method argument\n"}, 264 - {1, " \"Ascii String\"", "String method argument\n"}, 265 - {1, " (Hex Byte List)", "Buffer method argument\n"}, 266 - {1, " [Package Element List]", "Package method argument\n"}, 267 - {5, " Execute predefined", 268 - "Execute all predefined (public) methods\n"}, 269 346 {1, " Go", "Allow method to run to completion\n"}, 270 347 {1, " Information", "Display info about the current method\n"}, 271 348 {1, " Into", "Step into (not over) a method call\n"}, ··· 329 296 {1, " Results", "Display method result stack\n"}, 330 297 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, 331 298 {1, " Stop", "Terminate control method\n"}, 332 - {5, " Trace <State> [<Namepath>] [Once]", 333 - "Trace control method execution\n"}, 334 - {1, " Enable", "Enable all messages\n"}, 335 - {1, " Disable", "Disable tracing\n"}, 336 - {1, " Method", "Enable method execution messages\n"}, 337 - {1, " Opcode", "Enable opcode execution messages\n"}, 338 299 {1, " Tree", "Display control method calling tree\n"}, 339 300 {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, 340 301 341 302 #ifdef ACPI_APPLICATION 342 - {0, "\nHardware Simulation Commands:", "\n"}, 343 - {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, 344 - {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, 345 - {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, 346 - {1, " Gpes", "Display info on all GPE devices\n"}, 347 - {1, " Sci", "Generate an SCI\n"}, 348 - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, 349 - 350 - {0, "\nFile I/O Commands:", "\n"}, 303 + {0, "\nFile Operations:", "\n"}, 351 304 {1, " Close", "Close debug output file\n"}, 352 305 {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, 353 306 {1, " Open <Output Filename>", "Open a file for debug output\n"}, 354 307 {1, " Unload <Namepath>", 355 308 "Unload an ACPI table via namespace object\n"}, 356 309 357 - {0, "\nUser Space Commands:", "\n"}, 358 - {1, " Terminate", "Delete namespace and all internal objects\n"}, 359 - {1, " Thread <Threads><Loops><NamePath>", 360 - "Spawn threads to execute method(s)\n"}, 361 - 362 - {0, "\nDebug Test Commands:", "\n"}, 363 - {3, " Test <TestName>", "Invoke a debug test\n"}, 364 - {1, " Objects", "Read/write/compare all namespace data objects\n"}, 365 - {1, " Predefined", 366 - "Execute all ACPI predefined names (_STA, etc.)\n"}, 310 + {0, "\nHardware Simulation:", "\n"}, 311 + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, 312 + {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, 313 + {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, 314 + {1, " Gpes", "Display info on all GPE devices\n"}, 315 + {1, " Sci", "Generate an SCI\n"}, 316 + {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, 367 317 #endif 368 318 {0, NULL, NULL} 369 319 }; ··· 458 442 459 443 /* No argument to help, display help for all commands */ 460 444 445 + acpi_os_printf("\nSummary of AML Debugger Commands\n\n"); 446 + 461 447 while (next->invocation) { 462 448 acpi_os_printf("%-38s%s", next->invocation, 463 449 next->description); 464 450 next++; 465 451 } 452 + acpi_os_printf("\n"); 453 + 466 454 } else { 467 455 /* Display help for all commands that match the subtring */ 468 456 ··· 1105 1085 1106 1086 acpi_gbl_db_terminate_loop = TRUE; 1107 1087 /* acpi_initialize (NULL); */ 1088 + break; 1089 + 1090 + case CMD_BACKGROUND: 1091 + 1092 + acpi_db_create_execution_thread(acpi_gbl_db_args[1], 1093 + &acpi_gbl_db_args[2], 1094 + &acpi_gbl_db_arg_types[2]); 1108 1095 break; 1109 1096 1110 1097 case CMD_THREADS:
+10 -8
drivers/acpi/acpica/dscontrol.c
··· 118 118 control_state->control.package_end = 119 119 walk_state->parser_state.pkg_end; 120 120 control_state->control.opcode = op->common.aml_opcode; 121 + control_state->control.loop_timeout = acpi_os_get_timer() + 122 + (u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC); 121 123 122 124 /* Push the control state on this walk's control stack */ 123 125 ··· 208 206 /* Predicate was true, the body of the loop was just executed */ 209 207 210 208 /* 211 - * This loop counter mechanism allows the interpreter to escape 212 - * possibly infinite loops. This can occur in poorly written AML 213 - * when the hardware does not respond within a while loop and the 214 - * loop does not implement a timeout. 209 + * This infinite loop detection mechanism allows the interpreter 210 + * to escape possibly infinite loops. This can occur in poorly 211 + * written AML when the hardware does not respond within a while 212 + * loop and the loop does not implement a timeout. 215 213 */ 216 - control_state->control.loop_count++; 217 - if (control_state->control.loop_count > 218 - acpi_gbl_max_loop_iterations) { 219 - status = AE_AML_INFINITE_LOOP; 214 + if (ACPI_TIME_AFTER(acpi_os_get_timer(), 215 + control_state->control. 216 + loop_timeout)) { 217 + status = AE_AML_LOOP_TIMEOUT; 220 218 break; 221 219 } 222 220
+19 -9
drivers/acpi/acpica/dsfield.c
··· 209 209 ACPI_IMODE_LOAD_PASS1, flags, 210 210 walk_state, &node); 211 211 if (ACPI_FAILURE(status)) { 212 - ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 212 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 213 + arg->common.value.string, status); 213 214 return_ACPI_STATUS(status); 214 215 } 215 216 } ··· 384 383 walk_state, 385 384 &info->connection_node); 386 385 if (ACPI_FAILURE(status)) { 387 - ACPI_ERROR_NAMESPACE(child->common. 386 + ACPI_ERROR_NAMESPACE(walk_state-> 387 + scope_info, 388 + child->common. 388 389 value.name, 389 390 status); 390 391 return_ACPI_STATUS(status); ··· 405 402 ACPI_NS_DONT_OPEN_SCOPE, 406 403 walk_state, &info->field_node); 407 404 if (ACPI_FAILURE(status)) { 408 - ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 405 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 406 + (char *)&arg->named.name, 409 407 status); 410 408 return_ACPI_STATUS(status); 411 409 } else { ··· 502 498 &region_node); 503 499 #endif 504 500 if (ACPI_FAILURE(status)) { 505 - ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 501 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 502 + arg->common.value.name, status); 506 503 return_ACPI_STATUS(status); 507 504 } 508 505 } ··· 623 618 ACPI_IMODE_LOAD_PASS1, flags, 624 619 walk_state, &node); 625 620 if (ACPI_FAILURE(status)) { 626 - ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 621 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 622 + (char *)&arg->named.name, 627 623 status); 628 624 if (status != AE_ALREADY_EXISTS) { 629 625 return_ACPI_STATUS(status); ··· 687 681 &region_node); 688 682 #endif 689 683 if (ACPI_FAILURE(status)) { 690 - ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 684 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 685 + arg->common.value.name, status); 691 686 return_ACPI_STATUS(status); 692 687 } 693 688 } ··· 702 695 ACPI_NS_SEARCH_PARENT, walk_state, 703 696 &info.register_node); 704 697 if (ACPI_FAILURE(status)) { 705 - ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 698 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 699 + arg->common.value.string, status); 706 700 return_ACPI_STATUS(status); 707 701 } 708 702 ··· 773 765 ACPI_NS_SEARCH_PARENT, walk_state, 774 766 &info.register_node); 775 767 if (ACPI_FAILURE(status)) { 776 - ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 768 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 769 + arg->common.value.string, status); 777 770 return_ACPI_STATUS(status); 778 771 } 779 772 ··· 787 778 ACPI_NS_SEARCH_PARENT, walk_state, 788 779 &info.data_register_node); 789 780 if (ACPI_FAILURE(status)) { 790 - ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 781 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 782 + arg->common.value.string, status); 791 783 return_ACPI_STATUS(status); 792 784 } 793 785
+3 -1
drivers/acpi/acpica/dsobject.c
··· 112 112 acpi_namespace_node, 113 113 &(op->common.node))); 114 114 if (ACPI_FAILURE(status)) { 115 - ACPI_ERROR_NAMESPACE(op->common.value. 115 + ACPI_ERROR_NAMESPACE(walk_state-> 116 + scope_info, 117 + op->common.value. 116 118 string, status); 117 119 return_ACPI_STATUS(status); 118 120 }
+13 -8
drivers/acpi/acpica/dspkginit.c
··· 297 297 { 298 298 union acpi_operand_object **element_ptr; 299 299 300 + ACPI_FUNCTION_TRACE(ds_init_package_element); 301 + 300 302 if (!source_object) { 301 - return (AE_OK); 303 + return_ACPI_STATUS(AE_OK); 302 304 } 303 305 304 306 /* ··· 331 329 source_object->package.flags |= AOPOBJ_DATA_VALID; 332 330 } 333 331 334 - return (AE_OK); 332 + return_ACPI_STATUS(AE_OK); 335 333 } 336 334 337 335 /******************************************************************************* ··· 354 352 union acpi_generic_state scope_info; 355 353 union acpi_operand_object *element = *element_ptr; 356 354 struct acpi_namespace_node *resolved_node; 355 + struct acpi_namespace_node *original_node; 357 356 char *external_path = NULL; 358 357 acpi_object_type type; 359 358 ··· 444 441 * will remain as named references. This behavior is not described 445 442 * in the ACPI spec, but it appears to be an oversight. 446 443 */ 444 + original_node = resolved_node; 447 445 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); 448 446 if (ACPI_FAILURE(status)) { 449 447 return_VOID; ··· 472 468 */ 473 469 case ACPI_TYPE_DEVICE: 474 470 case ACPI_TYPE_THERMAL: 475 - 476 - /* TBD: This may not be necesssary */ 477 - 478 - acpi_ut_add_reference(resolved_node->object); 471 + case ACPI_TYPE_METHOD: 479 472 break; 480 473 481 474 case ACPI_TYPE_MUTEX: 482 - case ACPI_TYPE_METHOD: 483 475 case ACPI_TYPE_POWER: 484 476 case ACPI_TYPE_PROCESSOR: 485 477 case ACPI_TYPE_EVENT: 486 478 case ACPI_TYPE_REGION: 487 479 480 + /* acpi_ex_resolve_node_to_value gave these an extra reference */ 481 + 482 + acpi_ut_remove_reference(original_node->object); 488 483 break; 489 484 490 485 default: 491 486 /* 492 487 * For all other types - the node was resolved to an actual 493 - * operand object with a value, return the object 488 + * operand object with a value, return the object. Remove 489 + * a reference on the existing object. 494 490 */ 491 + acpi_ut_remove_reference(element); 495 492 *element_ptr = (union acpi_operand_object *)resolved_node; 496 493 break; 497 494 }
+2 -1
drivers/acpi/acpica/dsutils.c
··· 583 583 } 584 584 585 585 if (ACPI_FAILURE(status)) { 586 - ACPI_ERROR_NAMESPACE(name_string, status); 586 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 587 + name_string, status); 587 588 } 588 589 } 589 590
+4 -2
drivers/acpi/acpica/dswload.c
··· 207 207 } 208 208 #endif 209 209 if (ACPI_FAILURE(status)) { 210 - ACPI_ERROR_NAMESPACE(path, status); 210 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, 211 + status); 211 212 return_ACPI_STATUS(status); 212 213 } 213 214 ··· 376 375 } 377 376 378 377 if (ACPI_FAILURE(status)) { 379 - ACPI_ERROR_NAMESPACE(path, status); 378 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 379 + path, status); 380 380 return_ACPI_STATUS(status); 381 381 } 382 382 }
+9 -4
drivers/acpi/acpica/dswload2.c
··· 184 184 if (status == AE_NOT_FOUND) { 185 185 status = AE_OK; 186 186 } else { 187 - ACPI_ERROR_NAMESPACE(buffer_ptr, 187 + ACPI_ERROR_NAMESPACE(walk_state-> 188 + scope_info, 189 + buffer_ptr, 188 190 status); 189 191 } 190 192 #else 191 - ACPI_ERROR_NAMESPACE(buffer_ptr, status); 193 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 194 + buffer_ptr, status); 192 195 #endif 193 196 return_ACPI_STATUS(status); 194 197 } ··· 346 343 } 347 344 348 345 if (ACPI_FAILURE(status)) { 349 - ACPI_ERROR_NAMESPACE(buffer_ptr, status); 346 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 347 + buffer_ptr, status); 350 348 return_ACPI_STATUS(status); 351 349 } 352 350 ··· 723 719 */ 724 720 op->common.node = new_node; 725 721 } else { 726 - ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 722 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, 723 + arg->common.value.string, status); 727 724 } 728 725 break; 729 726
+10
drivers/acpi/acpica/evregion.c
··· 298 298 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]", 299 299 acpi_ut_get_region_name(region_obj->region. 300 300 space_id))); 301 + 302 + /* 303 + * Special case for an EC timeout. These are seen so frequently 304 + * that an additional error message is helpful 305 + */ 306 + if ((region_obj->region.space_id == ACPI_ADR_SPACE_EC) && 307 + (status == AE_TIME)) { 308 + ACPI_ERROR((AE_INFO, 309 + "Timeout from EC hardware or EC device driver")); 310 + } 301 311 } 302 312 303 313 if (!(handler_desc->address_space.handler_flags &
+6 -5
drivers/acpi/acpica/exdump.c
··· 617 617 u32 length; 618 618 u32 index; 619 619 620 - ACPI_FUNCTION_NAME(ex_dump_operand) 620 + ACPI_FUNCTION_NAME(ex_dump_operand); 621 621 622 - /* Check if debug output enabled */ 623 - if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) { 622 + /* Check if debug output enabled */ 623 + 624 + if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) { 624 625 return; 625 626 } 626 627 ··· 905 904 acpi_ex_dump_operands(union acpi_operand_object **operands, 906 905 const char *opcode_name, u32 num_operands) 907 906 { 908 - ACPI_FUNCTION_NAME(ex_dump_operands); 907 + ACPI_FUNCTION_TRACE(ex_dump_operands); 909 908 910 909 if (!opcode_name) { 911 910 opcode_name = "UNKNOWN"; ··· 929 928 930 929 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 931 930 "**** End operand dump for [%s]\n", opcode_name)); 932 - return; 931 + return_VOID; 933 932 } 934 933 935 934 /*******************************************************************************
+14 -15
drivers/acpi/acpica/hwtimer.c
··· 150 150 * 151 151 ******************************************************************************/ 152 152 acpi_status 153 - acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) 153 + acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 *time_elapsed) 154 154 { 155 155 acpi_status status; 156 - u32 delta_ticks; 156 + u64 delta_ticks; 157 157 u64 quotient; 158 158 159 159 ACPI_FUNCTION_TRACE(acpi_get_timer_duration); ··· 168 168 return_ACPI_STATUS(AE_SUPPORT); 169 169 } 170 170 171 + if (start_ticks == end_ticks) { 172 + *time_elapsed = 0; 173 + return_ACPI_STATUS(AE_OK); 174 + } 175 + 171 176 /* 172 177 * Compute Tick Delta: 173 178 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. 174 179 */ 175 - if (start_ticks < end_ticks) { 176 - delta_ticks = end_ticks - start_ticks; 177 - } else if (start_ticks > end_ticks) { 180 + delta_ticks = end_ticks; 181 + if (start_ticks > end_ticks) { 178 182 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) { 179 183 180 184 /* 24-bit Timer */ 181 185 182 - delta_ticks = 183 - (((0x00FFFFFF - start_ticks) + 184 - end_ticks) & 0x00FFFFFF); 186 + delta_ticks |= (u64)1 << 24; 185 187 } else { 186 188 /* 32-bit Timer */ 187 189 188 - delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; 190 + delta_ticks |= (u64)1 << 32; 189 191 } 190 - } else { /* start_ticks == end_ticks */ 191 - 192 - *time_elapsed = 0; 193 - return_ACPI_STATUS(AE_OK); 194 192 } 193 + delta_ticks -= start_ticks; 195 194 196 195 /* 197 196 * Compute Duration (Requires a 64-bit multiply and divide): ··· 198 199 * time_elapsed (microseconds) = 199 200 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; 200 201 */ 201 - status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC, 202 + status = acpi_ut_short_divide(delta_ticks * ACPI_USEC_PER_SEC, 202 203 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL); 203 204 204 - *time_elapsed = (u32) quotient; 205 + *time_elapsed = (u32)quotient; 205 206 return_ACPI_STATUS(status); 206 207 } 207 208
+7 -7
drivers/acpi/acpica/hwvalid.c
··· 128 128 acpi_io_address last_address; 129 129 const struct acpi_port_info *port_info; 130 130 131 - ACPI_FUNCTION_NAME(hw_validate_io_request); 131 + ACPI_FUNCTION_TRACE(hw_validate_io_request); 132 132 133 133 /* Supported widths are 8/16/32 */ 134 134 135 135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { 136 136 ACPI_ERROR((AE_INFO, 137 137 "Bad BitWidth parameter: %8.8X", bit_width)); 138 - return (AE_BAD_PARAMETER); 138 + return_ACPI_STATUS(AE_BAD_PARAMETER); 139 139 } 140 140 141 141 port_info = acpi_protected_ports; ··· 153 153 ACPI_ERROR((AE_INFO, 154 154 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", 155 155 ACPI_FORMAT_UINT64(address), byte_width)); 156 - return (AE_LIMIT); 156 + return_ACPI_STATUS(AE_LIMIT); 157 157 } 158 158 159 159 /* Exit if requested address is not within the protected port table */ 160 160 161 161 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) { 162 - return (AE_OK); 162 + return_ACPI_STATUS(AE_OK); 163 163 } 164 164 165 165 /* Check request against the list of protected I/O ports */ ··· 180 180 /* Port illegality may depend on the _OSI calls made by the BIOS */ 181 181 182 182 if (acpi_gbl_osi_data >= port_info->osi_dependency) { 183 - ACPI_DEBUG_PRINT((ACPI_DB_IO, 184 - "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", 183 + ACPI_DEBUG_PRINT((ACPI_DB_VALUES, 184 + "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", 185 185 ACPI_FORMAT_UINT64(address), 186 186 byte_width, port_info->name, 187 187 port_info->start, ··· 198 198 } 199 199 } 200 200 201 - return (AE_OK); 201 + return_ACPI_STATUS(AE_OK); 202 202 } 203 203 204 204 /******************************************************************************
+7 -6
drivers/acpi/acpica/nsaccess.c
··· 644 644 this_node->object; 645 645 } 646 646 } 647 - #ifdef ACPI_ASL_COMPILER 648 - if (!acpi_gbl_disasm_flag && 649 - (this_node->flags & ANOBJ_IS_EXTERNAL)) { 650 - this_node->flags |= IMPLICIT_EXTERNAL; 651 - } 652 - #endif 653 647 } 654 648 655 649 /* Special handling for the last segment (num_segments == 0) */ 656 650 657 651 else { 652 + #ifdef ACPI_ASL_COMPILER 653 + if (!acpi_gbl_disasm_flag 654 + && (this_node->flags & ANOBJ_IS_EXTERNAL)) { 655 + this_node->flags &= ~IMPLICIT_EXTERNAL; 656 + } 657 + #endif 658 + 658 659 /* 659 660 * Sanity typecheck of the target object: 660 661 *
+2 -1
drivers/acpi/acpica/nsconvert.c
··· 495 495 496 496 /* Check if we are resolving a named reference within a package */ 497 497 498 - ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); 498 + ACPI_ERROR_NAMESPACE(&scope_info, 499 + original_object->string.pointer, status); 499 500 goto error_exit; 500 501 } 501 502
+149
drivers/acpi/acpica/nsnames.c
··· 49 49 #define _COMPONENT ACPI_NAMESPACE 50 50 ACPI_MODULE_NAME("nsnames") 51 51 52 + /* Local Prototypes */ 53 + static void acpi_ns_normalize_pathname(char *original_path); 54 + 52 55 /******************************************************************************* 53 56 * 54 57 * FUNCTION: acpi_ns_get_external_pathname ··· 66 63 * for error and debug statements. 67 64 * 68 65 ******************************************************************************/ 66 + 69 67 char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) 70 68 { 71 69 char *name_buffer; ··· 355 351 no_trailing); 356 352 357 353 return_PTR(name_buffer); 354 + } 355 + 356 + /******************************************************************************* 357 + * 358 + * FUNCTION: acpi_ns_build_prefixed_pathname 359 + * 360 + * PARAMETERS: prefix_scope - Scope/Path that prefixes the internal path 361 + * internal_path - Name or path of the namespace node 362 + * 363 + * RETURN: None 364 + * 365 + * DESCRIPTION: Construct a fully qualified pathname from a concatenation of: 366 + * 1) Path associated with the prefix_scope namespace node 367 + * 2) External path representation of the Internal path 368 + * 369 + ******************************************************************************/ 370 + 371 + char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope, 372 + const char *internal_path) 373 + { 374 + acpi_status status; 375 + char *full_path = NULL; 376 + char *external_path = NULL; 377 + char *prefix_path = NULL; 378 + u32 prefix_path_length = 0; 379 + 380 + /* If there is a prefix, get the pathname to it */ 381 + 382 + if (prefix_scope && prefix_scope->scope.node) { 383 + prefix_path = 384 + acpi_ns_get_normalized_pathname(prefix_scope->scope.node, 385 + TRUE); 386 + if (prefix_path) { 387 + prefix_path_length = strlen(prefix_path); 388 + } 389 + } 390 + 391 + status = acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_path, 392 + NULL, &external_path); 393 + if (ACPI_FAILURE(status)) { 394 + goto cleanup; 395 + } 396 + 397 + /* Merge the prefix path and the path. 2 is for one dot and trailing null */ 398 + 399 + full_path = 400 + ACPI_ALLOCATE_ZEROED(prefix_path_length + strlen(external_path) + 401 + 2); 402 + if (!full_path) { 403 + goto cleanup; 404 + } 405 + 406 + /* Don't merge if the External path is already fully qualified */ 407 + 408 + if (prefix_path && (*external_path != '\\') && (*external_path != '^')) { 409 + strcat(full_path, prefix_path); 410 + if (prefix_path[1]) { 411 + strcat(full_path, "."); 412 + } 413 + } 414 + 415 + acpi_ns_normalize_pathname(external_path); 416 + strcat(full_path, external_path); 417 + 418 + cleanup: 419 + if (prefix_path) { 420 + ACPI_FREE(prefix_path); 421 + } 422 + if (external_path) { 423 + ACPI_FREE(external_path); 424 + } 425 + 426 + return (full_path); 427 + } 428 + 429 + /******************************************************************************* 430 + * 431 + * FUNCTION: acpi_ns_normalize_pathname 432 + * 433 + * PARAMETERS: original_path - Path to be normalized, in External format 434 + * 435 + * RETURN: The original path is processed in-place 436 + * 437 + * DESCRIPTION: Remove trailing underscores from each element of a path. 438 + * 439 + * For example: \A___.B___.C___ becomes \A.B.C 440 + * 441 + ******************************************************************************/ 442 + 443 + static void acpi_ns_normalize_pathname(char *original_path) 444 + { 445 + char *input_path = original_path; 446 + char *new_path_buffer; 447 + char *new_path; 448 + u32 i; 449 + 450 + /* Allocate a temp buffer in which to construct the new path */ 451 + 452 + new_path_buffer = ACPI_ALLOCATE_ZEROED(strlen(input_path) + 1); 453 + new_path = new_path_buffer; 454 + if (!new_path_buffer) { 455 + return; 456 + } 457 + 458 + /* Special characters may appear at the beginning of the path */ 459 + 460 + if (*input_path == '\\') { 461 + *new_path = *input_path; 462 + new_path++; 463 + input_path++; 464 + } 465 + 466 + while (*input_path == '^') { 467 + *new_path = *input_path; 468 + new_path++; 469 + input_path++; 470 + } 471 + 472 + /* Remainder of the path */ 473 + 474 + while (*input_path) { 475 + 476 + /* Do one nameseg at a time */ 477 + 478 + for (i = 0; (i < ACPI_NAME_SIZE) && *input_path; i++) { 479 + if ((i == 0) || (*input_path != '_')) { /* First char is allowed to be underscore */ 480 + *new_path = *input_path; 481 + new_path++; 482 + } 483 + 484 + input_path++; 485 + } 486 + 487 + /* Dot means that there are more namesegs to come */ 488 + 489 + if (*input_path == '.') { 490 + *new_path = *input_path; 491 + new_path++; 492 + input_path++; 493 + } 494 + } 495 + 496 + *new_path = 0; 497 + strcpy(original_path, new_path_buffer); 498 + ACPI_FREE(new_path_buffer); 358 499 }
+1
drivers/acpi/acpica/nssearch.c
··· 417 417 if (flags & ACPI_NS_EXTERNAL || 418 418 (walk_state && walk_state->opcode == AML_SCOPE_OP)) { 419 419 new_node->flags |= ANOBJ_IS_EXTERNAL; 420 + new_node->flags |= IMPLICIT_EXTERNAL; 420 421 } 421 422 #endif 422 423
+5 -4
drivers/acpi/acpica/nsxfeval.c
··· 61 61 * 62 62 * PARAMETERS: handle - Object handle (optional) 63 63 * pathname - Object pathname (optional) 64 - * external_params - List of parameters to pass to method, 64 + * external_params - List of parameters to pass to a method, 65 65 * terminated by NULL. May be NULL 66 66 * if no parameters are being passed. 67 - * return_buffer - Where to put method's return value (if 67 + * return_buffer - Where to put the object's return value (if 68 68 * any). If NULL, no value is returned. 69 69 * return_type - Expected type of return object 70 70 * ··· 100 100 free_buffer_on_error = TRUE; 101 101 } 102 102 103 + /* Get a handle here, in order to build an error message if needed */ 104 + 105 + target_handle = handle; 103 106 if (pathname) { 104 107 status = acpi_get_handle(handle, pathname, &target_handle); 105 108 if (ACPI_FAILURE(status)) { 106 109 return_ACPI_STATUS(status); 107 110 } 108 - } else { 109 - target_handle = handle; 110 111 } 111 112 112 113 full_pathname = acpi_ns_get_external_pathname(target_handle);
+1 -1
drivers/acpi/acpica/psargs.c
··· 361 361 /* Final exception check (may have been changed from code above) */ 362 362 363 363 if (ACPI_FAILURE(status)) { 364 - ACPI_ERROR_NAMESPACE(path, status); 364 + ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, status); 365 365 366 366 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 367 367 ACPI_PARSE_EXECUTE) {
+2 -8
drivers/acpi/acpica/psobject.c
··· 372 372 * external declaration opcode. Setting walk_state->Aml to 373 373 * walk_state->parser_state.Aml + 2 moves increments the 374 374 * walk_state->Aml past the object type and the paramcount of the 375 - * external opcode. For the error message, only print the AML 376 - * offset. We could attempt to print the name but this may cause 377 - * a segmentation fault when printing the namepath because the 378 - * AML may be incorrect. 375 + * external opcode. 379 376 */ 380 - acpi_os_printf 381 - ("// Invalid external declaration at AML offset 0x%x.\n", 382 - walk_state->aml - 383 - walk_state->parser_state.aml_start); 384 377 walk_state->aml = walk_state->parser_state.aml + 2; 378 + walk_state->parser_state.aml = walk_state->aml; 385 379 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); 386 380 } 387 381 #endif
+8 -6
drivers/acpi/acpica/psutils.c
··· 94 94 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; 95 95 op->common.aml_opcode = opcode; 96 96 97 - ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name, 98 - (acpi_ps_get_opcode_info(opcode))-> 99 - name, sizeof(op->common.aml_op_name))); 97 + ACPI_DISASM_ONLY_MEMBERS(acpi_ut_safe_strncpy(op->common.aml_op_name, 98 + (acpi_ps_get_opcode_info 99 + (opcode))->name, 100 + sizeof(op->common. 101 + aml_op_name))); 100 102 } 101 103 102 104 /******************************************************************************* ··· 160 158 if (opcode == AML_SCOPE_OP) { 161 159 acpi_gbl_current_scope = op; 162 160 } 163 - } 164 161 165 - if (gbl_capture_comments) { 166 - ASL_CV_TRANSFER_COMMENTS(op); 162 + if (acpi_gbl_capture_comments) { 163 + ASL_CV_TRANSFER_COMMENTS(op); 164 + } 167 165 } 168 166 169 167 return (op);
+16 -2
drivers/acpi/acpica/utdebug.c
··· 163 163 { 164 164 acpi_thread_id thread_id; 165 165 va_list args; 166 + #ifdef ACPI_APPLICATION 167 + int fill_count; 168 + #endif 166 169 167 170 /* Check if debug output enabled */ 168 171 ··· 205 202 acpi_os_printf("[%u] ", (u32)thread_id); 206 203 } 207 204 208 - acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level); 209 - #endif 205 + fill_count = 48 - acpi_gbl_nesting_level - 206 + strlen(acpi_ut_trim_function_name(function_name)); 207 + if (fill_count < 0) { 208 + fill_count = 0; 209 + } 210 210 211 + acpi_os_printf("[%02ld] %*s", 212 + acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " "); 213 + acpi_os_printf("%s%*s: ", 214 + acpi_ut_trim_function_name(function_name), fill_count, 215 + " "); 216 + 217 + #else 211 218 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); 219 + #endif 212 220 213 221 va_start(args, format); 214 222 acpi_os_vprintf(format, args);
+6 -5
drivers/acpi/acpica/utdecode.c
··· 395 395 return (acpi_gbl_ref_class_names[object->reference.class]); 396 396 } 397 397 398 - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 399 - /* 400 - * Strings and procedures used for debug only 401 - */ 402 - 403 398 /******************************************************************************* 404 399 * 405 400 * FUNCTION: acpi_ut_get_mutex_name ··· 427 432 428 433 return (acpi_gbl_mutex_names[mutex_id]); 429 434 } 435 + 436 + #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 437 + 438 + /* 439 + * Strings and procedures used for debug only 440 + */ 430 441 431 442 /******************************************************************************* 432 443 *
+73
drivers/acpi/acpica/uterror.c
··· 182 182 183 183 /******************************************************************************* 184 184 * 185 + * FUNCTION: acpi_ut_prefixed_namespace_error 186 + * 187 + * PARAMETERS: module_name - Caller's module name (for error output) 188 + * line_number - Caller's line number (for error output) 189 + * prefix_scope - Scope/Path that prefixes the internal path 190 + * internal_path - Name or path of the namespace node 191 + * lookup_status - Exception code from NS lookup 192 + * 193 + * RETURN: None 194 + * 195 + * DESCRIPTION: Print error message with the full pathname constructed this way: 196 + * 197 + * prefix_scope_node_full_path.externalized_internal_path 198 + * 199 + * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors 200 + * 201 + ******************************************************************************/ 202 + 203 + void 204 + acpi_ut_prefixed_namespace_error(const char *module_name, 205 + u32 line_number, 206 + union acpi_generic_state *prefix_scope, 207 + const char *internal_path, 208 + acpi_status lookup_status) 209 + { 210 + char *full_path; 211 + const char *message; 212 + 213 + /* 214 + * Main cases: 215 + * 1) Object creation, object must not already exist 216 + * 2) Object lookup, object must exist 217 + */ 218 + switch (lookup_status) { 219 + case AE_ALREADY_EXISTS: 220 + 221 + acpi_os_printf(ACPI_MSG_BIOS_ERROR); 222 + message = "Failure creating"; 223 + break; 224 + 225 + case AE_NOT_FOUND: 226 + 227 + acpi_os_printf(ACPI_MSG_BIOS_ERROR); 228 + message = "Failure looking up"; 229 + break; 230 + 231 + default: 232 + 233 + acpi_os_printf(ACPI_MSG_ERROR); 234 + message = "Failure looking up"; 235 + break; 236 + } 237 + 238 + /* Concatenate the prefix path and the internal path */ 239 + 240 + full_path = 241 + acpi_ns_build_prefixed_pathname(prefix_scope, internal_path); 242 + 243 + acpi_os_printf("%s [%s], %s", message, 244 + full_path ? full_path : "Could not get pathname", 245 + acpi_format_exception(lookup_status)); 246 + 247 + if (full_path) { 248 + ACPI_FREE(full_path); 249 + } 250 + 251 + ACPI_MSG_SUFFIX; 252 + } 253 + 254 + #ifdef __OBSOLETE_FUNCTION 255 + /******************************************************************************* 256 + * 185 257 * FUNCTION: acpi_ut_namespace_error 186 258 * 187 259 * PARAMETERS: module_name - Caller's module name (for error output) ··· 312 240 ACPI_MSG_SUFFIX; 313 241 ACPI_MSG_REDIRECT_END; 314 242 } 243 + #endif 315 244 316 245 /******************************************************************************* 317 246 *
-1
drivers/acpi/acpica/utinit.c
··· 206 206 acpi_gbl_next_owner_id_offset = 0; 207 207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 208 208 acpi_gbl_osi_mutex = NULL; 209 - acpi_gbl_max_loop_iterations = ACPI_MAX_LOOP_COUNT; 210 209 211 210 /* Hardware oriented */ 212 211
+2 -2
drivers/acpi/acpica/utmath.c
··· 134 134 135 135 if ((count & 63) >= 32) { 136 136 operand_ovl.part.hi = operand_ovl.part.lo; 137 - operand_ovl.part.lo ^= operand_ovl.part.lo; 137 + operand_ovl.part.lo = 0; 138 138 count = (count & 63) - 32; 139 139 } 140 140 ACPI_SHIFT_LEFT_64_BY_32(operand_ovl.part.hi, ··· 171 171 172 172 if ((count & 63) >= 32) { 173 173 operand_ovl.part.lo = operand_ovl.part.hi; 174 - operand_ovl.part.hi ^= operand_ovl.part.hi; 174 + operand_ovl.part.hi = 0; 175 175 count = (count & 63) - 32; 176 176 } 177 177 ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi,
+5 -4
drivers/acpi/acpica/utmutex.c
··· 286 286 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 287 287 } else { 288 288 ACPI_EXCEPTION((AE_INFO, status, 289 - "Thread %u could not acquire Mutex [0x%X]", 290 - (u32)this_thread_id, mutex_id)); 289 + "Thread %u could not acquire Mutex [%s] (0x%X)", 290 + (u32)this_thread_id, 291 + acpi_ut_get_mutex_name(mutex_id), mutex_id)); 291 292 } 292 293 293 294 return (status); ··· 323 322 */ 324 323 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 325 324 ACPI_ERROR((AE_INFO, 326 - "Mutex [0x%X] is not acquired, cannot release", 327 - mutex_id)); 325 + "Mutex [%s] (0x%X) is not acquired, cannot release", 326 + acpi_ut_get_mutex_name(mutex_id), mutex_id)); 328 327 329 328 return (AE_NOT_ACQUIRED); 330 329 }
+10 -1
drivers/acpi/acpica/utnonansi.c
··· 140 140 return (c1 - c2); 141 141 } 142 142 143 - #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 143 + #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT) 144 144 /******************************************************************************* 145 145 * 146 146 * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat ··· 199 199 strncat(dest, source, max_transfer_length); 200 200 return (FALSE); 201 201 } 202 + 203 + void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size) 204 + { 205 + /* Always terminate destination string */ 206 + 207 + strncpy(dest, source, dest_size); 208 + dest[dest_size - 1] = 0; 209 + } 210 + 202 211 #endif
+2
drivers/acpi/acpica/utosi.c
··· 101 101 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ 102 102 {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ 103 103 {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ 104 + {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */ 105 + {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */ 104 106 105 107 /* Feature Group Strings */ 106 108
+24 -18
drivers/acpi/acpica/utstrsuppt.c
··· 52 52 acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit); 53 53 54 54 static acpi_status 55 - acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product); 55 + acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product); 56 56 57 - static acpi_status 58 - acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum); 57 + static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum); 59 58 60 59 /******************************************************************************* 61 60 * ··· 356 357 * FUNCTION: acpi_ut_strtoul_multiply64 357 358 * 358 359 * PARAMETERS: multiplicand - Current accumulated converted integer 359 - * multiplier - Base/Radix 360 + * base - Base/Radix 360 361 * out_product - Where the product is returned 361 362 * 362 363 * RETURN: Status and 64-bit product ··· 368 369 ******************************************************************************/ 369 370 370 371 static acpi_status 371 - acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product) 372 + acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product) 372 373 { 373 - u64 val; 374 + u64 product; 375 + u64 quotient; 374 376 375 377 /* Exit if either operand is zero */ 376 378 377 379 *out_product = 0; 378 - if (!multiplicand || !multiplier) { 380 + if (!multiplicand || !base) { 379 381 return (AE_OK); 380 382 } 381 383 382 - /* Check for 64-bit overflow before the actual multiplication */ 383 - 384 - acpi_ut_short_divide(ACPI_UINT64_MAX, (u32)multiplier, &val, NULL); 385 - if (multiplicand > val) { 384 + /* 385 + * Check for 64-bit overflow before the actual multiplication. 386 + * 387 + * Notes: 64-bit division is often not supported on 32-bit platforms 388 + * (it requires a library function), Therefore ACPICA has a local 389 + * 64-bit divide function. Also, Multiplier is currently only used 390 + * as the radix (8/10/16), to the 64/32 divide will always work. 391 + */ 392 + acpi_ut_short_divide(ACPI_UINT64_MAX, base, &quotient, NULL); 393 + if (multiplicand > quotient) { 386 394 return (AE_NUMERIC_OVERFLOW); 387 395 } 388 396 389 - val = multiplicand * multiplier; 397 + product = multiplicand * base; 390 398 391 399 /* Check for 32-bit overflow if necessary */ 392 400 393 - if ((acpi_gbl_integer_bit_width == 32) && (val > ACPI_UINT32_MAX)) { 401 + if ((acpi_gbl_integer_bit_width == 32) && (product > ACPI_UINT32_MAX)) { 394 402 return (AE_NUMERIC_OVERFLOW); 395 403 } 396 404 397 - *out_product = val; 405 + *out_product = product; 398 406 return (AE_OK); 399 407 } 400 408 ··· 410 404 * FUNCTION: acpi_ut_strtoul_add64 411 405 * 412 406 * PARAMETERS: addend1 - Current accumulated converted integer 413 - * addend2 - New hex value/char 407 + * digit - New hex value/char 414 408 * out_sum - Where sum is returned (Accumulator) 415 409 * 416 410 * RETURN: Status and 64-bit sum ··· 421 415 * 422 416 ******************************************************************************/ 423 417 424 - static acpi_status acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum) 418 + static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum) 425 419 { 426 420 u64 sum; 427 421 428 422 /* Check for 64-bit overflow before the actual addition */ 429 423 430 - if ((addend1 > 0) && (addend2 > (ACPI_UINT64_MAX - addend1))) { 424 + if ((addend1 > 0) && (digit > (ACPI_UINT64_MAX - addend1))) { 431 425 return (AE_NUMERIC_OVERFLOW); 432 426 } 433 427 434 - sum = addend1 + addend2; 428 + sum = addend1 + digit; 435 429 436 430 /* Check for 32-bit overflow if necessary */ 437 431
+3 -3
drivers/acpi/acpica/uttrack.c
··· 402 402 allocation->component = component; 403 403 allocation->line = line; 404 404 405 - strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME); 406 - allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; 405 + acpi_ut_safe_strncpy(allocation->module, (char *)module, 406 + ACPI_MAX_MODULE_NAME); 407 407 408 408 if (!element) { 409 409 ··· 717 717 if (!num_outstanding) { 718 718 ACPI_INFO(("No outstanding allocations")); 719 719 } else { 720 - ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations", 720 + ACPI_ERROR((AE_INFO, "%u (0x%X) Outstanding cache allocations", 721 721 num_outstanding, num_outstanding)); 722 722 } 723 723
+4 -4
drivers/acpi/acpica/utxferror.c
··· 96 96 * 97 97 * RETURN: None 98 98 * 99 - * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 100 - * and decoded acpi_status. 99 + * DESCRIPTION: Print an "ACPI Error" message with module/line/version 100 + * info as well as decoded acpi_status. 101 101 * 102 102 ******************************************************************************/ 103 103 void ACPI_INTERNAL_VAR_XFACE ··· 111 111 /* For AE_OK, just print the message */ 112 112 113 113 if (ACPI_SUCCESS(status)) { 114 - acpi_os_printf(ACPI_MSG_EXCEPTION); 114 + acpi_os_printf(ACPI_MSG_ERROR); 115 115 116 116 } else { 117 - acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 117 + acpi_os_printf(ACPI_MSG_ERROR "%s, ", 118 118 acpi_format_exception(status)); 119 119 } 120 120
+46 -33
drivers/acpi/apei/ghes.c
··· 414 414 #endif 415 415 } 416 416 417 + /* 418 + * PCIe AER errors need to be sent to the AER driver for reporting and 419 + * recovery. The GHES severities map to the following AER severities and 420 + * require the following handling: 421 + * 422 + * GHES_SEV_CORRECTABLE -> AER_CORRECTABLE 423 + * These need to be reported by the AER driver but no recovery is 424 + * necessary. 425 + * GHES_SEV_RECOVERABLE -> AER_NONFATAL 426 + * GHES_SEV_RECOVERABLE && CPER_SEC_RESET -> AER_FATAL 427 + * These both need to be reported and recovered from by the AER driver. 428 + * GHES_SEV_PANIC does not make it to this handling since the kernel must 429 + * panic. 430 + */ 431 + static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) 432 + { 433 + #ifdef CONFIG_ACPI_APEI_PCIEAER 434 + struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); 435 + 436 + if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && 437 + pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) { 438 + unsigned int devfn; 439 + int aer_severity; 440 + 441 + devfn = PCI_DEVFN(pcie_err->device_id.device, 442 + pcie_err->device_id.function); 443 + aer_severity = cper_severity_to_aer(gdata->error_severity); 444 + 445 + /* 446 + * If firmware reset the component to contain 447 + * the error, we must reinitialize it before 448 + * use, so treat it as a fatal AER error. 449 + */ 450 + if (gdata->flags & CPER_SEC_RESET) 451 + aer_severity = AER_FATAL; 452 + 453 + aer_recover_queue(pcie_err->device_id.segment, 454 + pcie_err->device_id.bus, 455 + devfn, aer_severity, 456 + (struct aer_capability_regs *) 457 + pcie_err->aer_info); 458 + } 459 + #endif 460 + } 461 + 417 462 static void ghes_do_proc(struct ghes *ghes, 418 463 const struct acpi_hest_generic_status *estatus) 419 464 { ··· 486 441 arch_apei_report_mem_error(sev, mem_err); 487 442 ghes_handle_memory_failure(gdata, sev); 488 443 } 489 - #ifdef CONFIG_ACPI_APEI_PCIEAER 490 444 else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { 491 - struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); 492 - 493 - if (sev == GHES_SEV_RECOVERABLE && 494 - sec_sev == GHES_SEV_RECOVERABLE && 495 - pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && 496 - pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) { 497 - unsigned int devfn; 498 - int aer_severity; 499 - 500 - devfn = PCI_DEVFN(pcie_err->device_id.device, 501 - pcie_err->device_id.function); 502 - aer_severity = cper_severity_to_aer(gdata->error_severity); 503 - 504 - /* 505 - * If firmware reset the component to contain 506 - * the error, we must reinitialize it before 507 - * use, so treat it as a fatal AER error. 508 - */ 509 - if (gdata->flags & CPER_SEC_RESET) 510 - aer_severity = AER_FATAL; 511 - 512 - aer_recover_queue(pcie_err->device_id.segment, 513 - pcie_err->device_id.bus, 514 - devfn, aer_severity, 515 - (struct aer_capability_regs *) 516 - pcie_err->aer_info); 517 - } 518 - 445 + ghes_handle_aer(gdata); 519 446 } 520 - #endif 521 447 else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { 522 448 struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); 523 449 ··· 886 870 struct ghes_estatus_node *estatus_node; 887 871 struct acpi_hest_generic *generic; 888 872 struct acpi_hest_generic_status *estatus; 889 - u32 len, node_len; 890 873 891 874 llnode = llist_del_all(&ghes_estatus_llist); 892 875 /* ··· 897 882 estatus_node = llist_entry(llnode, struct ghes_estatus_node, 898 883 llnode); 899 884 estatus = GHES_ESTATUS_FROM_NODE(estatus_node); 900 - len = cper_estatus_len(estatus); 901 - node_len = GHES_ESTATUS_NODE_LEN(len); 902 885 generic = estatus_node->generic; 903 886 ghes_print_estatus(NULL, generic, estatus); 904 887 llnode = llnode->next;
+30 -6
drivers/acpi/battery.c
··· 70 70 static bool battery_driver_registered; 71 71 static int battery_bix_broken_package; 72 72 static int battery_notification_delay_ms; 73 + static int battery_full_discharging; 73 74 static unsigned int cache_time = 1000; 74 75 module_param(cache_time, uint, 0644); 75 76 MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); ··· 215 214 return -ENODEV; 216 215 switch (psp) { 217 216 case POWER_SUPPLY_PROP_STATUS: 218 - if (battery->state & ACPI_BATTERY_STATE_DISCHARGING) 219 - val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 220 - else if (battery->state & ACPI_BATTERY_STATE_CHARGING) 217 + if (battery->state & ACPI_BATTERY_STATE_DISCHARGING) { 218 + if (battery_full_discharging && battery->rate_now == 0) 219 + val->intval = POWER_SUPPLY_STATUS_FULL; 220 + else 221 + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 222 + } else if (battery->state & ACPI_BATTERY_STATE_CHARGING) 221 223 val->intval = POWER_SUPPLY_STATUS_CHARGING; 222 224 else if (acpi_battery_is_charged(battery)) 223 225 val->intval = POWER_SUPPLY_STATUS_FULL; ··· 1170 1166 return 0; 1171 1167 } 1172 1168 1169 + static int __init battery_full_discharging_quirk(const struct dmi_system_id *d) 1170 + { 1171 + battery_full_discharging = 1; 1172 + return 0; 1173 + } 1174 + 1173 1175 static const struct dmi_system_id bat_dmi_table[] __initconst = { 1174 1176 { 1175 1177 .callback = battery_bix_broken_package_quirk, ··· 1191 1181 .matches = { 1192 1182 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 1193 1183 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), 1184 + }, 1185 + }, 1186 + { 1187 + .callback = battery_full_discharging_quirk, 1188 + .ident = "ASUS GL502VSK", 1189 + .matches = { 1190 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 1191 + DMI_MATCH(DMI_PRODUCT_NAME, "GL502VSK"), 1192 + }, 1193 + }, 1194 + { 1195 + .callback = battery_full_discharging_quirk, 1196 + .ident = "ASUS UX305LA", 1197 + .matches = { 1198 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 1199 + DMI_MATCH(DMI_PRODUCT_NAME, "UX305LA"), 1194 1200 }, 1195 1201 }, 1196 1202 {}, ··· 1263 1237 1264 1238 #ifdef CONFIG_ACPI_PROCFS_POWER 1265 1239 result = acpi_battery_add_fs(device); 1266 - #endif 1267 1240 if (result) { 1268 - #ifdef CONFIG_ACPI_PROCFS_POWER 1269 1241 acpi_battery_remove_fs(device); 1270 - #endif 1271 1242 goto fail; 1272 1243 } 1244 + #endif 1273 1245 1274 1246 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 1275 1247 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
+22
drivers/acpi/button.c
··· 30 30 #include <linux/input.h> 31 31 #include <linux/slab.h> 32 32 #include <linux/acpi.h> 33 + #include <linux/dmi.h> 33 34 #include <acpi/button.h> 34 35 35 36 #define PREFIX "ACPI: " ··· 76 75 {"", 0}, 77 76 }; 78 77 MODULE_DEVICE_TABLE(acpi, button_device_ids); 78 + 79 + /* 80 + * Some devices which don't even have a lid in anyway have a broken _LID 81 + * method (e.g. pointing to a floating gpio pin) causing spurious LID events. 82 + */ 83 + static const struct dmi_system_id lid_blacklst[] = { 84 + { 85 + /* GP-electronic T701 */ 86 + .matches = { 87 + DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 88 + DMI_MATCH(DMI_PRODUCT_NAME, "T701"), 89 + DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"), 90 + }, 91 + }, 92 + {} 93 + }; 79 94 80 95 static int acpi_button_add(struct acpi_device *device); 81 96 static int acpi_button_remove(struct acpi_device *device); ··· 227 210 } 228 211 /* Send the platform triggered reliable event */ 229 212 if (do_update) { 213 + acpi_handle_debug(device->handle, "ACPI LID %s\n", 214 + state ? "open" : "closed"); 230 215 input_report_switch(button->input, SW_LID, !state); 231 216 input_sync(button->input); 232 217 button->last_state = !!state; ··· 491 472 const char *hid = acpi_device_hid(device); 492 473 char *name, *class; 493 474 int error; 475 + 476 + if (!strcmp(hid, ACPI_BUTTON_HID_LID) && dmi_check_system(lid_blacklst)) 477 + return -ENODEV; 494 478 495 479 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); 496 480 if (!button)
+1 -1
drivers/acpi/ec.c
··· 1516 1516 } 1517 1517 1518 1518 acpi_handle_info(ec->handle, 1519 - "GPE=0x%lx, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", 1519 + "GPE=0x%x, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", 1520 1520 ec->gpe, ec->command_addr, ec->data_addr); 1521 1521 return ret; 1522 1522 }
+1 -1
drivers/acpi/ec_sys.c
··· 128 128 return -ENOMEM; 129 129 } 130 130 131 - if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe)) 131 + if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe)) 132 132 goto error; 133 133 if (!debugfs_create_bool("use_global_lock", 0444, dev_dir, 134 134 &first_ec->global_lock))
+41 -6
drivers/acpi/evged.c
··· 49 49 50 50 #define MODULE_NAME "acpi-ged" 51 51 52 + struct acpi_ged_device { 53 + struct device *dev; 54 + struct list_head event_list; 55 + }; 56 + 52 57 struct acpi_ged_event { 53 58 struct list_head node; 54 59 struct device *dev; ··· 81 76 unsigned int irq; 82 77 unsigned int gsi; 83 78 unsigned int irqflags = IRQF_ONESHOT; 84 - struct device *dev = context; 79 + struct acpi_ged_device *geddev = context; 80 + struct device *dev = geddev->dev; 85 81 acpi_handle handle = ACPI_HANDLE(dev); 86 82 acpi_handle evt_handle; 87 83 struct resource r; ··· 108 102 return AE_ERROR; 109 103 } 110 104 111 - dev_info(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq); 112 - 113 105 event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL); 114 106 if (!event) 115 107 return AE_ERROR; ··· 120 116 if (r.flags & IORESOURCE_IRQ_SHAREABLE) 121 117 irqflags |= IRQF_SHARED; 122 118 123 - if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler, 124 - irqflags, "ACPI:Ged", event)) { 119 + if (request_threaded_irq(irq, NULL, acpi_ged_irq_handler, 120 + irqflags, "ACPI:Ged", event)) { 125 121 dev_err(dev, "failed to setup event handler for irq %u\n", irq); 126 122 return AE_ERROR; 127 123 } 128 124 125 + dev_dbg(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq); 126 + list_add_tail(&event->node, &geddev->event_list); 129 127 return AE_OK; 130 128 } 131 129 132 130 static int ged_probe(struct platform_device *pdev) 133 131 { 132 + struct acpi_ged_device *geddev; 134 133 acpi_status acpi_ret; 135 134 135 + geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL); 136 + if (!geddev) 137 + return -ENOMEM; 138 + 139 + geddev->dev = &pdev->dev; 140 + INIT_LIST_HEAD(&geddev->event_list); 136 141 acpi_ret = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), "_CRS", 137 - acpi_ged_request_interrupt, &pdev->dev); 142 + acpi_ged_request_interrupt, geddev); 138 143 if (ACPI_FAILURE(acpi_ret)) { 139 144 dev_err(&pdev->dev, "unable to parse the _CRS record\n"); 140 145 return -EINVAL; 141 146 } 147 + platform_set_drvdata(pdev, geddev); 142 148 149 + return 0; 150 + } 151 + 152 + static void ged_shutdown(struct platform_device *pdev) 153 + { 154 + struct acpi_ged_device *geddev = platform_get_drvdata(pdev); 155 + struct acpi_ged_event *event, *next; 156 + 157 + list_for_each_entry_safe(event, next, &geddev->event_list, node) { 158 + free_irq(event->irq, event); 159 + list_del(&event->node); 160 + dev_dbg(geddev->dev, "GED releasing GSI %u @ IRQ %u\n", 161 + event->gsi, event->irq); 162 + } 163 + } 164 + 165 + static int ged_remove(struct platform_device *pdev) 166 + { 167 + ged_shutdown(pdev); 143 168 return 0; 144 169 } 145 170 ··· 179 146 180 147 static struct platform_driver ged_driver = { 181 148 .probe = ged_probe, 149 + .remove = ged_remove, 150 + .shutdown = ged_shutdown, 182 151 .driver = { 183 152 .name = MODULE_NAME, 184 153 .acpi_match_table = ACPI_PTR(ged_acpi_ids),
+1 -1
drivers/acpi/internal.h
··· 159 159 -------------------------------------------------------------------------- */ 160 160 struct acpi_ec { 161 161 acpi_handle handle; 162 - unsigned long gpe; 162 + u32 gpe; 163 163 unsigned long command_addr; 164 164 unsigned long data_addr; 165 165 bool global_lock;
+1 -2
drivers/acpi/numa.c
··· 460 460 srat_proc, ARRAY_SIZE(srat_proc), 0); 461 461 462 462 cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, 463 - acpi_parse_memory_affinity, 464 - NR_NODE_MEMBLKS); 463 + acpi_parse_memory_affinity, 0); 465 464 } 466 465 467 466 /* SLIT: System Locality Information Table */
+1 -1
drivers/acpi/pci_link.c
··· 612 612 acpi_isa_irq_penalty[link->irq.active] += 613 613 PIRQ_PENALTY_PCI_USING; 614 614 615 - printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", 615 + pr_info("%s [%s] enabled at IRQ %d\n", 616 616 acpi_device_name(link->device), 617 617 acpi_device_bid(link->device), link->irq.active); 618 618 }
+2 -7
drivers/acpi/pmic/intel_pmic_bxtwc.c
··· 400 400 &intel_bxtwc_pmic_opregion_data); 401 401 } 402 402 403 - static struct platform_device_id bxt_wc_opregion_id_table[] = { 403 + static const struct platform_device_id bxt_wc_opregion_id_table[] = { 404 404 { .name = "bxt_wcove_region" }, 405 405 {}, 406 406 }; ··· 412 412 }, 413 413 .id_table = bxt_wc_opregion_id_table, 414 414 }; 415 - 416 - static int __init intel_bxtwc_pmic_opregion_driver_init(void) 417 - { 418 - return platform_driver_register(&intel_bxtwc_pmic_opregion_driver); 419 - } 420 - device_initcall(intel_bxtwc_pmic_opregion_driver_init); 415 + builtin_platform_driver(intel_bxtwc_pmic_opregion_driver);
+1 -4
drivers/acpi/pmic/intel_pmic_chtdc_ti.c
··· 131 131 }, 132 132 .id_table = chtdc_ti_pmic_opregion_id_table, 133 133 }; 134 - module_platform_driver(chtdc_ti_pmic_opregion_driver); 135 - 136 - MODULE_DESCRIPTION("Dollar Cove TI PMIC opregion driver"); 137 - MODULE_LICENSE("GPL v2"); 134 + builtin_platform_driver(chtdc_ti_pmic_opregion_driver);
+2 -7
drivers/acpi/pmic/intel_pmic_chtwc.c
··· 260 260 &intel_cht_wc_pmic_opregion_data); 261 261 } 262 262 263 - static struct platform_device_id cht_wc_opregion_id_table[] = { 263 + static const struct platform_device_id cht_wc_opregion_id_table[] = { 264 264 { .name = "cht_wcove_region" }, 265 265 {}, 266 266 }; 267 - MODULE_DEVICE_TABLE(platform, cht_wc_opregion_id_table); 268 267 269 268 static struct platform_driver intel_cht_wc_pmic_opregion_driver = { 270 269 .probe = intel_cht_wc_pmic_opregion_probe, ··· 272 273 }, 273 274 .id_table = cht_wc_opregion_id_table, 274 275 }; 275 - module_platform_driver(intel_cht_wc_pmic_opregion_driver); 276 - 277 - MODULE_DESCRIPTION("Intel CHT Whiskey Cove PMIC operation region driver"); 278 - MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); 279 - MODULE_LICENSE("GPL"); 276 + builtin_platform_driver(intel_cht_wc_pmic_opregion_driver);
+1 -6
drivers/acpi/pmic/intel_pmic_crc.c
··· 201 201 .name = "crystal_cove_pmic", 202 202 }, 203 203 }; 204 - 205 - static int __init intel_crc_pmic_opregion_driver_init(void) 206 - { 207 - return platform_driver_register(&intel_crc_pmic_opregion_driver); 208 - } 209 - device_initcall(intel_crc_pmic_opregion_driver_init); 204 + builtin_platform_driver(intel_crc_pmic_opregion_driver);
+1 -6
drivers/acpi/pmic/intel_pmic_xpower.c
··· 278 278 .name = "axp288_pmic_acpi", 279 279 }, 280 280 }; 281 - 282 - static int __init intel_xpower_pmic_opregion_driver_init(void) 283 - { 284 - return platform_driver_register(&intel_xpower_pmic_opregion_driver); 285 - } 286 - device_initcall(intel_xpower_pmic_opregion_driver_init); 281 + builtin_platform_driver(intel_xpower_pmic_opregion_driver);
+8 -18
drivers/acpi/sysfs.c
··· 816 816 * interface: 817 817 * echo unmask > /sys/firmware/acpi/interrupts/gpe00 818 818 */ 819 - 820 - /* 821 - * Currently, the GPE flooding prevention only supports to mask the GPEs 822 - * numbered from 00 to 7f. 823 - */ 824 - #define ACPI_MASKABLE_GPE_MAX 0x80 825 - 826 - static u64 __initdata acpi_masked_gpes; 819 + #define ACPI_MASKABLE_GPE_MAX 0xFF 820 + static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata; 827 821 828 822 static int __init acpi_gpe_set_masked_gpes(char *val) 829 823 { ··· 825 831 826 832 if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX) 827 833 return -EINVAL; 828 - acpi_masked_gpes |= ((u64)1<<gpe); 834 + set_bit(gpe, acpi_masked_gpes_map); 829 835 830 836 return 1; 831 837 } ··· 837 843 acpi_status status; 838 844 u8 gpe; 839 845 840 - for (gpe = 0; 841 - gpe < min_t(u8, ACPI_MASKABLE_GPE_MAX, acpi_current_gpe_count); 842 - gpe++) { 843 - if (acpi_masked_gpes & ((u64)1<<gpe)) { 844 - status = acpi_get_gpe_device(gpe, &handle); 845 - if (ACPI_SUCCESS(status)) { 846 - pr_info("Masking GPE 0x%x.\n", gpe); 847 - (void)acpi_mask_gpe(handle, gpe, TRUE); 848 - } 846 + for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) { 847 + status = acpi_get_gpe_device(gpe, &handle); 848 + if (ACPI_SUCCESS(status)) { 849 + pr_info("Masking GPE 0x%x.\n", gpe); 850 + (void)acpi_mask_gpe(handle, gpe, TRUE); 849 851 } 850 852 } 851 853 }
+2 -2
include/acpi/acconfig.h
··· 145 145 146 146 #define ACPI_ADDRESS_RANGE_MAX 2 147 147 148 - /* Maximum number of While() loops before abort */ 148 + /* Maximum time (default 30s) of While() loops before abort */ 149 149 150 - #define ACPI_MAX_LOOP_COUNT 0x000FFFFF 150 + #define ACPI_MAX_LOOP_TIMEOUT 30 151 151 152 152 /****************************************************************************** 153 153 *
+7 -5
include/acpi/acexcep.h
··· 130 130 #define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) 131 131 #define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) 132 132 #define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) 133 + #define AE_END_OF_TABLE EXCEP_ENV (0x0023) 133 134 134 - #define AE_CODE_ENV_MAX 0x0022 135 + #define AE_CODE_ENV_MAX 0x0023 135 136 136 137 /* 137 138 * Programmer exceptions ··· 196 195 #define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) 197 196 #define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) 198 197 #define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) 199 - #define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) 198 + #define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021) 200 199 #define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) 201 200 #define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) 202 201 ··· 276 275 EXCEP_TXT("AE_DECIMAL_OVERFLOW", 277 276 "Overflow during ASCII decimal-to-binary conversion"), 278 277 EXCEP_TXT("AE_OCTAL_OVERFLOW", 279 - "Overflow during ASCII octal-to-binary conversion") 278 + "Overflow during ASCII octal-to-binary conversion"), 279 + EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table") 280 280 }; 281 281 282 282 static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { ··· 370 368 "The length of a Resource Descriptor in the AML is incorrect"), 371 369 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS", 372 370 "A memory, I/O, or PCI configuration address is invalid"), 373 - EXCEP_TXT("AE_AML_INFINITE_LOOP", 374 - "An apparent infinite AML While loop, method was aborted"), 371 + EXCEP_TXT("AE_AML_LOOP_TIMEOUT", 372 + "An AML While loop exceeded the maximum execution time"), 375 373 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE", 376 374 "A namespace node is uninitialized or unresolved"), 377 375 EXCEP_TXT("AE_AML_TARGET_TYPE",
+3 -3
include/acpi/acpixf.h
··· 46 46 47 47 /* Current ACPICA subsystem version in YYYYMMDD format */ 48 48 49 - #define ACPI_CA_VERSION 0x20170831 49 + #define ACPI_CA_VERSION 0x20171215 50 50 51 51 #include <acpi/acconfig.h> 52 52 #include <acpi/actypes.h> ··· 260 260 ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); 261 261 262 262 /* 263 - * Maximum number of While() loop iterations before forced method abort. 263 + * Maximum timeout for While() loop iterations before forced method abort. 264 264 * This mechanism is intended to prevent infinite loops during interpreter 265 265 * execution within a host kernel. 266 266 */ 267 - ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_COUNT); 267 + ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT); 268 268 269 269 /* 270 270 * This mechanism is used to trace a specified AML method. The method is
+150 -9
include/acpi/actbl1.h
··· 69 69 #define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 70 70 #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 71 71 #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ 72 - #define ACPI_SIG_PDTT "PDTT" /* Processor Debug Trigger Table */ 72 + #define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */ 73 73 #define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ 74 74 #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 75 + #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ 75 76 #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 76 77 #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 77 78 #define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ ··· 1150 1149 ACPI_NFIT_TYPE_CONTROL_REGION = 4, 1151 1150 ACPI_NFIT_TYPE_DATA_REGION = 5, 1152 1151 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, 1153 - ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ 1152 + ACPI_NFIT_TYPE_CAPABILITIES = 7, 1153 + ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */ 1154 1154 }; 1155 1155 1156 1156 /* ··· 1164 1162 struct acpi_nfit_header header; 1165 1163 u16 range_index; 1166 1164 u16 flags; 1167 - u32 reserved; /* Reseved, must be zero */ 1165 + u32 reserved; /* Reserved, must be zero */ 1168 1166 u32 proximity_domain; 1169 1167 u8 range_guid[16]; 1170 1168 u64 address; ··· 1283 1281 u64 hint_address[1]; /* Variable length */ 1284 1282 }; 1285 1283 1284 + /* 7: Platform Capabilities Structure */ 1285 + 1286 + struct acpi_nfit_capabilities { 1287 + struct acpi_nfit_header header; 1288 + u8 highest_capability; 1289 + u8 reserved[3]; /* Reserved, must be zero */ 1290 + u32 capabilities; 1291 + u32 reserved2; 1292 + }; 1293 + 1294 + /* Capabilities Flags */ 1295 + 1296 + #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */ 1297 + #define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */ 1298 + #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */ 1299 + 1300 + /* 1301 + * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM 1302 + */ 1303 + struct nfit_device_handle { 1304 + u32 handle; 1305 + }; 1306 + 1307 + /* Device handle construction and extraction macros */ 1308 + 1309 + #define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F 1310 + #define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0 1311 + #define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00 1312 + #define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000 1313 + #define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000 1314 + 1315 + #define ACPI_NFIT_DIMM_NUMBER_OFFSET 0 1316 + #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4 1317 + #define ACPI_NFIT_MEMORY_ID_OFFSET 8 1318 + #define ACPI_NFIT_SOCKET_ID_OFFSET 12 1319 + #define ACPI_NFIT_NODE_ID_OFFSET 16 1320 + 1321 + /* Macro to construct a NFIT/NVDIMM device handle */ 1322 + 1323 + #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \ 1324 + ((dimm) | \ 1325 + ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \ 1326 + ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \ 1327 + ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \ 1328 + ((node) << ACPI_NFIT_NODE_ID_OFFSET)) 1329 + 1330 + /* Macros to extract individual fields from a NFIT/NVDIMM device handle */ 1331 + 1332 + #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \ 1333 + ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK) 1334 + 1335 + #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \ 1336 + (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET) 1337 + 1338 + #define ACPI_NFIT_GET_MEMORY_ID(handle) \ 1339 + (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET) 1340 + 1341 + #define ACPI_NFIT_GET_SOCKET_ID(handle) \ 1342 + (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET) 1343 + 1344 + #define ACPI_NFIT_GET_NODE_ID(handle) \ 1345 + (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET) 1346 + 1286 1347 /******************************************************************************* 1287 1348 * 1288 - * PDTT - Processor Debug Trigger Table (ACPI 6.2) 1349 + * PDTT - Platform Debug Trigger Table (ACPI 6.2) 1289 1350 * Version 0 1290 1351 * 1291 1352 ******************************************************************************/ ··· 1366 1301 * starting at array_offset. 1367 1302 */ 1368 1303 struct acpi_pdtt_channel { 1369 - u16 sub_channel_id; 1304 + u8 subchannel_id; 1305 + u8 flags; 1370 1306 }; 1371 1307 1372 - /* Mask and Flags for above */ 1308 + /* Flags for above */ 1373 1309 1374 - #define ACPI_PDTT_SUBCHANNEL_ID_MASK 0x00FF 1375 - #define ACPI_PDTT_RUNTIME_TRIGGER (1<<8) 1376 - #define ACPI_PPTT_WAIT_COMPLETION (1<<9) 1310 + #define ACPI_PDTT_RUNTIME_TRIGGER (1) 1311 + #define ACPI_PDTT_WAIT_COMPLETION (1<<1) 1377 1312 1378 1313 /******************************************************************************* 1379 1314 * ··· 1441 1376 #define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ 1442 1377 #define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ 1443 1378 1379 + /* Attributes describing cache */ 1380 + #define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */ 1381 + #define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */ 1382 + #define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */ 1383 + #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */ 1384 + 1385 + #define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */ 1386 + #define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */ 1387 + #define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */ 1388 + #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */ 1389 + 1390 + #define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */ 1391 + #define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */ 1392 + 1444 1393 /* 2: ID Structure */ 1445 1394 1446 1395 struct acpi_pptt_id { ··· 1480 1401 u32 warning_level; 1481 1402 u32 low_level; 1482 1403 u32 critical_level; 1404 + }; 1405 + 1406 + /******************************************************************************* 1407 + * 1408 + * SDEV - Secure Devices Table (ACPI 6.2) 1409 + * Version 1 1410 + * 1411 + ******************************************************************************/ 1412 + 1413 + struct acpi_table_sdev { 1414 + struct acpi_table_header header; /* Common ACPI table header */ 1415 + }; 1416 + 1417 + struct acpi_sdev_header { 1418 + u8 type; 1419 + u8 flags; 1420 + u16 length; 1421 + }; 1422 + 1423 + /* Values for subtable type above */ 1424 + 1425 + enum acpi_sdev_type { 1426 + ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0, 1427 + ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1, 1428 + ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */ 1429 + }; 1430 + 1431 + /* Values for flags above */ 1432 + 1433 + #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1) 1434 + 1435 + /* 1436 + * SDEV subtables 1437 + */ 1438 + 1439 + /* 0: Namespace Device Based Secure Device Structure */ 1440 + 1441 + struct acpi_sdev_namespace { 1442 + struct acpi_sdev_header header; 1443 + u16 device_id_offset; 1444 + u16 device_id_length; 1445 + u16 vendor_data_offset; 1446 + u16 vendor_data_length; 1447 + }; 1448 + 1449 + /* 1: PCIe Endpoint Device Based Device Structure */ 1450 + 1451 + struct acpi_sdev_pcie { 1452 + struct acpi_sdev_header header; 1453 + u16 segment; 1454 + u16 start_bus; 1455 + u16 path_offset; 1456 + u16 path_length; 1457 + u16 vendor_data_offset; 1458 + u16 vendor_data_length; 1459 + }; 1460 + 1461 + /* 1a: PCIe Endpoint path entry */ 1462 + 1463 + struct acpi_sdev_pcie_path { 1464 + u8 device; 1465 + u8 function; 1483 1466 }; 1484 1467 1485 1468 /*******************************************************************************
+14 -1
include/acpi/actbl2.h
··· 810 810 u8 pxm; 811 811 u8 reserved1; 812 812 u16 reserved2; 813 + u32 id_mapping_index; 813 814 }; 814 815 815 816 /* Values for Model field above */ ··· 1247 1246 * TCPA - Trusted Computing Platform Alliance table 1248 1247 * Version 2 1249 1248 * 1249 + * TCG Hardware Interface Table for TPM 1.2 Clients and Servers 1250 + * 1250 1251 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1251 1252 * Version 1.2, Revision 8 1252 1253 * February 27, 2017 ··· 1313 1310 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table 1314 1311 * Version 4 1315 1312 * 1313 + * TCG Hardware Interface Table for TPM 2.0 Clients and Servers 1314 + * 1316 1315 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1317 1316 * Version 1.2, Revision 8 1318 1317 * February 27, 2017 ··· 1334 1329 /* Values for start_method above */ 1335 1330 1336 1331 #define ACPI_TPM2_NOT_ALLOWED 0 1332 + #define ACPI_TPM2_RESERVED1 1 1337 1333 #define ACPI_TPM2_START_METHOD 2 1334 + #define ACPI_TPM2_RESERVED3 3 1335 + #define ACPI_TPM2_RESERVED4 4 1336 + #define ACPI_TPM2_RESERVED5 5 1338 1337 #define ACPI_TPM2_MEMORY_MAPPED 6 1339 1338 #define ACPI_TPM2_COMMAND_BUFFER 7 1340 1339 #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 1340 + #define ACPI_TPM2_RESERVED9 9 1341 + #define ACPI_TPM2_RESERVED10 10 1341 1342 #define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ 1343 + #define ACPI_TPM2_RESERVED 12 1342 1344 1343 - /* Trailer appears after any start_method subtables */ 1345 + /* Optional trailer appears after any start_method subtables */ 1344 1346 1345 1347 struct acpi_tpm2_trailer { 1348 + u8 method_parameters[12]; 1346 1349 u32 minimum_log_length; /* Minimum length for the event log area */ 1347 1350 u64 log_address; /* Address of the event log area */ 1348 1351 };
+4
include/acpi/actypes.h
··· 468 468 #define ACPI_NSEC_PER_MSEC 1000000L 469 469 #define ACPI_NSEC_PER_SEC 1000000000L 470 470 471 + #define ACPI_TIME_AFTER(a, b) ((s64)((b) - (a)) < 0) 472 + 471 473 /* Owner IDs are used to track namespace nodes for selective deletion */ 472 474 473 475 typedef u8 acpi_owner_id; ··· 1301 1299 #define ACPI_OSI_WIN_7 0x0B 1302 1300 #define ACPI_OSI_WIN_8 0x0C 1303 1301 #define ACPI_OSI_WIN_10 0x0D 1302 + #define ACPI_OSI_WIN_10_RS1 0x0E 1303 + #define ACPI_OSI_WIN_10_RS2 0x0F 1304 1304 1305 1305 /* Definitions of getopt */ 1306 1306
+24 -4
tools/power/acpi/tools/acpidump/apmain.c
··· 79 79 u32 current_action = 0; 80 80 81 81 #define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" 82 - #define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz" 82 + #define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:sv^xz" 83 83 84 84 /****************************************************************************** 85 85 * ··· 100 100 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP"); 101 101 ACPI_OPTION("-s", "Print table summaries only"); 102 102 ACPI_OPTION("-v", "Display version information"); 103 + ACPI_OPTION("-vd", "Display build date and time"); 103 104 ACPI_OPTION("-z", "Verbose mode"); 104 105 105 106 ACPI_USAGE_TEXT("\nTable Options:\n"); ··· 232 231 } 233 232 continue; 234 233 235 - case 'v': /* Revision/version */ 234 + case 'v': /* -v: (Version): signon already emitted, just exit */ 236 235 237 - acpi_os_printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 238 - return (1); 236 + switch (acpi_gbl_optarg[0]) { 237 + case '^': /* -v: (Version) */ 238 + 239 + fprintf(stderr, 240 + ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 241 + return (1); 242 + 243 + case 'd': 244 + 245 + fprintf(stderr, 246 + ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 247 + printf(ACPI_COMMON_BUILD_TIME); 248 + return (1); 249 + 250 + default: 251 + 252 + printf("Unknown option: -v%s\n", 253 + acpi_gbl_optarg); 254 + return (-1); 255 + } 256 + break; 239 257 240 258 case 'z': /* Verbose mode */ 241 259