FreeBSD/sys/contrib/dev/acpica/components/events/evmisc.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiEvQueueNotifyRequest
 *
 * PARAMETERS:  Node            - NS node for the notified object
 *              NotifyValue     - Value from the Notify() request
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Dispatch a device notification event to a previously
 *              installed handler.
 *
 ******************************************************************************/
AcpiEvQueueNotifyRequest
PARAMETERS:  Node            - NS node for the notified object
NotifyValue     - Value from the Notify() request

Status

Dispatch a device notification event to a previously
installed handler.
AcpiEvQueueNotifyRequest PARAMETERS : Node - NS node for the notified object NotifyValue - Value from the Notify () request Status Dispatch a device notification event to a previously installed handler .
ACPI_STATUS
AcpiEvQueueNotifyRequest (
    ACPI_NAMESPACE_NODE     *Node,
    UINT32                  NotifyValue)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *HandlerListHead = NULL;
    ACPI_GENERIC_STATE      *Info;
    UINT8                   HandlerListId = 0;
    ACPI_STATUS             Status = AE_OK;
    ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
    if (!AcpiEvIsNotifyObject (Node))
    {
        return (AE_TYPE);
    }
    if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
    {
        HandlerListId = ACPI_SYSTEM_HANDLER_LIST;
    }
    else
    {
        HandlerListId = ACPI_DEVICE_HANDLER_LIST;
    }
    ObjDesc = AcpiNsGetAttachedObject (Node);
    if (ObjDesc)
    {
        HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId];
    }
    if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead)
    {
        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
            "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n",
            AcpiUtGetNodeName (Node), NotifyValue, Node));
        return (AE_OK);
    }
    Info = AcpiUtCreateGenericState ();
    if (!Info)
    {
        return (AE_NO_MEMORY);
    }
    Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
    Info->Notify.Node = Node;
    Info->Notify.Value = (UINT16) NotifyValue;
    Info->Notify.HandlerListId = HandlerListId;
    Info->Notify.HandlerListHead = HandlerListHead;
    Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId];
    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
        "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
        AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type),
        NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node));
    Status = AcpiOsExecute (OSL_NOTIFY_HANDLER,
        AcpiEvNotifyDispatch, Info);
    if (ACPI_FAILURE (Status))
    {
        AcpiUtDeleteGenericState (Info);
    }
    return (Status);
}
ACPI_STATUS AcpiEvQueueNotifyRequest ( ACPI_NAMESPACE_NODE * Node , UINT32 NotifyValue ) { ACPI_OPERAND_OBJECT * ObjDesc ; ACPI_OPERAND_OBJECT * HandlerListHead = NULL ; ACPI_GENERIC_STATE * Info ; UINT8 HandlerListId = 0 ; ACPI_STATUS Status = AE_OK ; ACPI_FUNCTION_NAME ( EvQueueNotifyRequest ) ; if ( ! AcpiEvIsNotifyObject ( Node ) ) { return ( AE_TYPE ) ; } if ( NotifyValue <= ACPI_MAX_SYS_NOTIFY ) { HandlerListId = ACPI_SYSTEM_HANDLER_LIST ; } else { HandlerListId = ACPI_DEVICE_HANDLER_LIST ; } ObjDesc = AcpiNsGetAttachedObject ( Node ) ; if ( ObjDesc ) { HandlerListHead = ObjDesc -> CommonNotify . NotifyList [ HandlerListId ] ; } if ( ! AcpiGbl_GlobalNotify [ HandlerListId ] . Handler && ! HandlerListHead ) { ACPI_DEBUG_PRINT ( ( ACPI_DB_INFO , " \n " , AcpiUtGetNodeName ( Node ) , NotifyValue , Node ) ) ; return ( AE_OK ) ; } Info = AcpiUtCreateGenericState ( ) ; if ( ! Info ) { return ( AE_NO_MEMORY ) ; } Info -> Common . DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY ; Info -> Notify . Node = Node ; Info -> Notify . Value = ( UINT16 ) NotifyValue ; Info -> Notify . HandlerListId = HandlerListId ; Info -> Notify . HandlerListHead = HandlerListHead ; Info -> Notify . Global = & AcpiGbl_GlobalNotify [ HandlerListId ] ; ACPI_DEBUG_PRINT ( ( ACPI_DB_INFO , " \n " , AcpiUtGetNodeName ( Node ) , AcpiUtGetTypeName ( Node -> Type ) , NotifyValue , AcpiUtGetNotifyName ( NotifyValue , ACPI_TYPE_ANY ) , Node ) ) ; Status = AcpiOsExecute ( OSL_NOTIFY_HANDLER , AcpiEvNotifyDispatch , Info ) ; if ( ACPI_FAILURE ( Status ) ) { AcpiUtDeleteGenericState ( Info ) ; } return ( Status ) ; }
FUNCTION:    AcpiEvQueueNotifyRequest
 PARAMETERS:  Node            - NS node for the notified object
              NotifyValue     - Value from the Notify() request
FUNCTION : AcpiEvQueueNotifyRequest PARAMETERS : Node - NS node for the notified object NotifyValue - Value from the Notify () request
/* Are Notifies allowed on this object? */ /* Get the correct notify list type (System or Device) */ /* Get the notify object attached to the namespace Node */ /* We have an attached object, Get the correct handler list */ /*
     * If there is no notify handler (Global or Local)
     * for this object, just ignore the notify
     */ /* Setup notify info and schedule the notify dispatcher */