aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utxface.c
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2010-08-05 21:35:51 -0400
committerLen Brown <len.brown@intel.com>2010-10-01 01:47:43 -0400
commitb0ed7a915abac309fcb5a51bccd3782e3daa7417 (patch)
tree0bffdd098549d61180e6959217c84a05dadb99fa /drivers/acpi/acpica/utxface.c
parent09387b43153953006471dbb06ece6bf779d10937 (diff)
ACPICA/ACPI: Add new host interfaces for _OSI support
Adds install/remove interfaces so that the host can dynamically alter the global _OSI table. Also adds support for _OSI handlers. Additional support: new debugger command (osi), and test support in the acpiexec utility. Adds new file, utilities/utosi.c. ACPICA bugzilla 836. The Linux OSL _OSI code is also changed. acpi_osi_setup can't call acpi_install/remove_interface because ACPICA is not initialized yet at this early time. So we just save the osi string in acpi_osi_setup and will handle it later in a new function acpi_osi_setup_late. http://www.acpica.org/bugzilla/show_bug.cgi?id=836 Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/utxface.c')
-rw-r--r--drivers/acpi/acpica/utxface.c125
1 files changed, 124 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 7f8cefcb2b32..c2da90f5fbe9 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -110,6 +110,15 @@ acpi_status __init acpi_initialize_subsystem(void)
110 return_ACPI_STATUS(status); 110 return_ACPI_STATUS(status);
111 } 111 }
112 112
113 /* Initialize the global OSI interfaces list with the static names */
114
115 status = acpi_ut_initialize_interfaces();
116 if (ACPI_FAILURE(status)) {
117 ACPI_EXCEPTION((AE_INFO, status,
118 "During OSI interfaces initialization"));
119 return_ACPI_STATUS(status);
120 }
121
113 /* If configured, initialize the AML debugger */ 122 /* If configured, initialize the AML debugger */
114 123
115 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); 124 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
@@ -506,6 +515,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
506 515
507ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) 516ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
508#endif /* ACPI_FUTURE_USAGE */ 517#endif /* ACPI_FUTURE_USAGE */
518
509/***************************************************************************** 519/*****************************************************************************
510 * 520 *
511 * FUNCTION: acpi_purge_cached_objects 521 * FUNCTION: acpi_purge_cached_objects
@@ -529,4 +539,117 @@ acpi_status acpi_purge_cached_objects(void)
529} 539}
530 540
531ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) 541ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
532#endif 542
543/*****************************************************************************
544 *
545 * FUNCTION: acpi_install_interface
546 *
547 * PARAMETERS: interface_name - The interface to install
548 *
549 * RETURN: Status
550 *
551 * DESCRIPTION: Install an _OSI interface to the global list
552 *
553 ****************************************************************************/
554acpi_status acpi_install_interface(acpi_string interface_name)
555{
556 acpi_status status;
557 struct acpi_interface_info *interface_info;
558
559 /* Parameter validation */
560
561 if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
562 return (AE_BAD_PARAMETER);
563 }
564
565 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
566
567 /* Check if the interface name is already in the global list */
568
569 interface_info = acpi_ut_get_interface(interface_name);
570 if (interface_info) {
571 /*
572 * The interface already exists in the list. This is OK if the
573 * interface has been marked invalid -- just clear the bit.
574 */
575 if (interface_info->flags & ACPI_OSI_INVALID) {
576 interface_info->flags &= ~ACPI_OSI_INVALID;
577 status = AE_OK;
578 } else {
579 status = AE_ALREADY_EXISTS;
580 }
581 } else {
582 /* New interface name, install into the global list */
583
584 status = acpi_ut_install_interface(interface_name);
585 }
586
587 acpi_os_release_mutex(acpi_gbl_osi_mutex);
588 return (status);
589}
590
591ACPI_EXPORT_SYMBOL(acpi_install_interface)
592
593/*****************************************************************************
594 *
595 * FUNCTION: acpi_remove_interface
596 *
597 * PARAMETERS: interface_name - The interface to remove
598 *
599 * RETURN: Status
600 *
601 * DESCRIPTION: Remove an _OSI interface from the global list
602 *
603 ****************************************************************************/
604acpi_status acpi_remove_interface(acpi_string interface_name)
605{
606 acpi_status status;
607
608 /* Parameter validation */
609
610 if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
611 return (AE_BAD_PARAMETER);
612 }
613
614 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
615
616 status = acpi_ut_remove_interface(interface_name);
617
618 acpi_os_release_mutex(acpi_gbl_osi_mutex);
619 return (status);
620}
621
622ACPI_EXPORT_SYMBOL(acpi_remove_interface)
623
624/*****************************************************************************
625 *
626 * FUNCTION: acpi_install_interface_handler
627 *
628 * PARAMETERS: Handler - The _OSI interface handler to install
629 * NULL means "remove existing handler"
630 *
631 * RETURN: Status
632 *
633 * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
634 * invoked during execution of the internal implementation of
635 * _OSI. A NULL handler simply removes any existing handler.
636 *
637 ****************************************************************************/
638acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
639{
640 acpi_status status = AE_OK;
641
642 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
643
644 if (handler && acpi_gbl_interface_handler) {
645 status = AE_ALREADY_EXISTS;
646 } else {
647 acpi_gbl_interface_handler = handler;
648 }
649
650 acpi_os_release_mutex(acpi_gbl_osi_mutex);
651 return (status);
652}
653
654ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
655#endif /* !ACPI_ASL_COMPILER */