Skip to content

Commit

Permalink
Tables: Add AcpiCompareParentTable() to check if an object is owned b…
Browse files Browse the repository at this point in the history
…y a specified table

This patch adds an API to be used to check if an object is owned by a
specified table. Lv Zheng.

Known issues:
1. Recursive lock
   In order to use this function in ACPI_TABLE_HANDLER, ACPI_TABLE_HANDLER
   need to be improved to avoid the recursive locking of MTX_TABLES.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Apr 6, 2016
1 parent 7e9fe97 commit 505d9ff
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
49 changes: 49 additions & 0 deletions source/components/tables/tbxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,3 +614,52 @@ AcpiRemoveTableHandler (
}

ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler)


/*******************************************************************************
*
* FUNCTION: AcpiCompareParentTable
*
* PARAMETERS: TableIndex - Table index
* Object - Namespace object to check if it is owned by
* the specified table.
*
* RETURN: TRUE if the object was owned by the table, FALSE otherwise.
*
* DESCRIPTION: Check if a namespace object is owned by the table.
*
******************************************************************************/

BOOLEAN
AcpiCompareParentTable (
UINT32 TableIndex,
ACPI_HANDLE Object)
{
ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);
BOOLEAN IsParent = FALSE;
ACPI_OWNER_ID OwnerId;


ACPI_FUNCTION_TRACE (AcpiCompareParentTable);

if (!Node->OwnerId)
{
goto ErrorExit;
}

(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
if (OwnerId == Node->OwnerId)
{
IsParent = TRUE;
}
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);

ErrorExit:
return_UINT8 (IsParent);
}

ACPI_EXPORT_SYMBOL (AcpiCompareParentTable)
16 changes: 16 additions & 0 deletions source/include/acpixf.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@
Prototype;
#endif

#ifndef ACPI_EXTERNAL_RETURN_TRUE
#define ACPI_EXTERNAL_RETURN_TRUE(Prototype) \
Prototype;
#endif

#ifndef ACPI_EXTERNAL_RETURN_FALSE
#define ACPI_EXTERNAL_RETURN_FALSE(Prototype) \
Prototype;
#endif

#ifndef ACPI_EXTERNAL_RETURN_OK
#define ACPI_EXTERNAL_RETURN_OK(Prototype) \
Prototype;
Expand Down Expand Up @@ -624,6 +634,12 @@ ACPI_STATUS ACPI_INIT_FUNCTION
AcpiLoadTables (
void))

ACPI_EXTERNAL_RETURN_FALSE (
BOOLEAN
AcpiCompareParentTable (
UINT32 TableIndex,
ACPI_HANDLE Object))


/*
* ACPI table manipulation interfaces
Expand Down

0 comments on commit 505d9ff

Please sign in to comment.