aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/utxface.c')
-rw-r--r--drivers/acpi/acpica/utxface.c138
1 files changed, 124 insertions, 14 deletions
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 7f8cefcb2b3..1f484c9a688 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());
@@ -290,19 +299,6 @@ acpi_status acpi_initialize_objects(u32 flags)
290 } 299 }
291 300
292 /* 301 /*
293 * Complete the GPE initialization for the GPE blocks defined in the FADT
294 * (GPE block 0 and 1).
295 *
296 * NOTE: Currently, there seems to be no need to run the _REG methods
297 * before enabling the GPEs.
298 */
299 if (!(flags & ACPI_NO_EVENT_INIT)) {
300 status = acpi_ev_install_fadt_gpes();
301 if (ACPI_FAILURE(status))
302 return (status);
303 }
304
305 /*
306 * Empty the caches (delete the cached objects) on the assumption that 302 * Empty the caches (delete the cached objects) on the assumption that
307 * the table load filled them up more than they will be at runtime -- 303 * the table load filled them up more than they will be at runtime --
308 * thus wasting non-paged memory. 304 * thus wasting non-paged memory.
@@ -506,6 +502,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
506 502
507ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) 503ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
508#endif /* ACPI_FUTURE_USAGE */ 504#endif /* ACPI_FUTURE_USAGE */
505
509/***************************************************************************** 506/*****************************************************************************
510 * 507 *
511 * FUNCTION: acpi_purge_cached_objects 508 * FUNCTION: acpi_purge_cached_objects
@@ -529,4 +526,117 @@ acpi_status acpi_purge_cached_objects(void)
529} 526}
530 527
531ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) 528ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
532#endif 529
530/*****************************************************************************
531 *
532 * FUNCTION: acpi_install_interface
533 *
534 * PARAMETERS: interface_name - The interface to install
535 *
536 * RETURN: Status
537 *
538 * DESCRIPTION: Install an _OSI interface to the global list
539 *
540 ****************************************************************************/
541acpi_status acpi_install_interface(acpi_string interface_name)
542{
543 acpi_status status;
544 struct acpi_interface_info *interface_info;
545
546 /* Parameter validation */
547
548 if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
549 return (AE_BAD_PARAMETER);
550 }
551
552 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
553
554 /* Check if the interface name is already in the global list */
555
556 interface_info = acpi_ut_get_interface(interface_name);
557 if (interface_info) {
558 /*
559 * The interface already exists in the list. This is OK if the
560 * interface has been marked invalid -- just clear the bit.
561 */
562 if (interface_info->flags & ACPI_OSI_INVALID) {
563 interface_info->flags &= ~ACPI_OSI_INVALID;
564 status = AE_OK;
565 } else {
566 status = AE_ALREADY_EXISTS;
567 }
568 } else {
569 /* New interface name, install into the global list */
570
571 status = acpi_ut_install_interface(interface_name);
572 }
573
574 acpi_os_release_mutex(acpi_gbl_osi_mutex);
575 return (status);
576}
577
578ACPI_EXPORT_SYMBOL(acpi_install_interface)
579
580/*****************************************************************************
581 *
582 * FUNCTION: acpi_remove_interface
583 *
584 * PARAMETERS: interface_name - The interface to remove
585 *
586 * RETURN: Status
587 *
588 * DESCRIPTION: Remove an _OSI interface from the global list
589 *
590 ****************************************************************************/
591acpi_status acpi_remove_interface(acpi_string interface_name)
592{
593 acpi_status status;
594
595 /* Parameter validation */
596
597 if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
598 return (AE_BAD_PARAMETER);
599 }
600
601 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
602
603 status = acpi_ut_remove_interface(interface_name);
604
605 acpi_os_release_mutex(acpi_gbl_osi_mutex);
606 return (status);
607}
608
609ACPI_EXPORT_SYMBOL(acpi_remove_interface)
610
611/*****************************************************************************
612 *
613 * FUNCTION: acpi_install_interface_handler
614 *
615 * PARAMETERS: Handler - The _OSI interface handler to install
616 * NULL means "remove existing handler"
617 *
618 * RETURN: Status
619 *
620 * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
621 * invoked during execution of the internal implementation of
622 * _OSI. A NULL handler simply removes any existing handler.
623 *
624 ****************************************************************************/
625acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
626{
627 acpi_status status = AE_OK;
628
629 (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
630
631 if (handler && acpi_gbl_interface_handler) {
632 status = AE_ALREADY_EXISTS;
633 } else {
634 acpi_gbl_interface_handler = handler;
635 }
636
637 acpi_os_release_mutex(acpi_gbl_osi_mutex);
638 return (status);
639}
640
641ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
642#endif /* !ACPI_ASL_COMPILER */