summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/utilities/utxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/utilities/utxface.c')
-rw-r--r--sys/contrib/dev/acpica/utilities/utxface.c150
1 files changed, 149 insertions, 1 deletions
diff --git a/sys/contrib/dev/acpica/utilities/utxface.c b/sys/contrib/dev/acpica/utilities/utxface.c
index d000b0c..5c130d8 100644
--- a/sys/contrib/dev/acpica/utilities/utxface.c
+++ b/sys/contrib/dev/acpica/utilities/utxface.c
@@ -193,6 +193,15 @@ AcpiInitializeSubsystem (
return_ACPI_STATUS (Status);
}
+ /* Initialize the global OSI interfaces list with the static names */
+
+ Status = AcpiUtInitializeInterfaces ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization"));
+ return_ACPI_STATUS (Status);
+ }
+
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
@@ -730,5 +739,144 @@ AcpiPurgeCachedObjects (
ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
-#endif /* ACPI_ASL_COMPILER */
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiInstallInterface
+ *
+ * PARAMETERS: InterfaceName - The interface to install
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install an _OSI interface to the global list
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiInstallInterface (
+ ACPI_STRING InterfaceName)
+{
+ ACPI_STATUS Status;
+ ACPI_INTERFACE_INFO *InterfaceInfo;
+
+
+ /* Parameter validation */
+
+ if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
+
+ /* Check if the interface name is already in the global list */
+
+ InterfaceInfo = AcpiUtGetInterface (InterfaceName);
+ if (InterfaceInfo)
+ {
+ /*
+ * The interface already exists in the list. This is OK if the
+ * interface has been marked invalid -- just clear the bit.
+ */
+ if (InterfaceInfo->Flags & ACPI_OSI_INVALID)
+ {
+ InterfaceInfo->Flags &= ~ACPI_OSI_INVALID;
+ Status = AE_OK;
+ }
+ else
+ {
+ Status = AE_ALREADY_EXISTS;
+ }
+ }
+ else
+ {
+ /* New interface name, install into the global list */
+
+ Status = AcpiUtInstallInterface (InterfaceName);
+ }
+
+ AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
+ return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiInstallInterface)
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiRemoveInterface
+ *
+ * PARAMETERS: InterfaceName - The interface to remove
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove an _OSI interface from the global list
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveInterface (
+ ACPI_STRING InterfaceName)
+{
+ ACPI_STATUS Status;
+
+
+ /* Parameter validation */
+
+ if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
+
+ Status = AcpiUtRemoveInterface (InterfaceName);
+
+ AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
+ return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiRemoveInterface)
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiInstallInterfaceHandler
+ *
+ * PARAMETERS: Handler - The _OSI interface handler to install
+ * NULL means "remove existing handler"
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
+ * invoked during execution of the internal implementation of
+ * _OSI. A NULL handler simply removes any existing handler.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiInstallInterfaceHandler (
+ ACPI_INTERFACE_HANDLER Handler)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
+
+ if (Handler && AcpiGbl_InterfaceHandler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ }
+ else
+ {
+ AcpiGbl_InterfaceHandler = Handler;
+ }
+
+ AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
+ return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler)
+
+#endif /* !ACPI_ASL_COMPILER */
OpenPOWER on IntegriCloud