Пример #1
0
ACPI_STATUS
AcpiGetGpeStatus (
    ACPI_HANDLE             GpeDevice,
    UINT32                  GpeNumber,
    ACPI_EVENT_STATUS       *EventStatus)
{
    ACPI_STATUS             Status = AE_OK;
    ACPI_GPE_EVENT_INFO     *GpeEventInfo;
    ACPI_CPU_FLAGS          Flags;


    ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);


    Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);

    /* Ensure that we have a valid GPE number */

    GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
    if (!GpeEventInfo)
    {
        Status = AE_BAD_PARAMETER;
        goto UnlockAndExit;
    }

    /* Obtain status on the requested GPE number */

    Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);

UnlockAndExit:
    AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
    return_ACPI_STATUS (Status);
}
Пример #2
0
ACPI_STATUS
AcpiGetGpeStatus (
    ACPI_HANDLE             GpeDevice,
    UINT32                  GpeNumber,
    UINT32                  Flags,
    ACPI_EVENT_STATUS       *EventStatus)
{
    ACPI_STATUS             Status = AE_OK;
    ACPI_GPE_EVENT_INFO     *GpeEventInfo;


    ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);


    /* Use semaphore lock if not executing at interrupt level */

    if (Flags & ACPI_NOT_ISR)
    {
        Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
        if (ACPI_FAILURE (Status))
        {
            return_ACPI_STATUS (Status);
        }
    }

    /* Ensure that we have a valid GPE number */

    GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
    if (!GpeEventInfo)
    {
        Status = AE_BAD_PARAMETER;
        goto UnlockAndExit;
    }

    /* Obtain status on the requested GPE number */

    Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);

UnlockAndExit:
    if (Flags & ACPI_NOT_ISR)
    {
        (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
    }
    return_ACPI_STATUS (Status);
}
Пример #3
0
ACPI_STATUS
AcpiGetEventStatus (
    UINT32                  Event,
    UINT32                  Type,
    ACPI_EVENT_STATUS       *EventStatus)
{
    ACPI_STATUS             Status = AE_OK;
    UINT32                  RegisterId;


    FUNCTION_TRACE ("AcpiGetEventStatus");


    /* Ensure that ACPI has been initialized */

    ACPI_IS_INITIALIZATION_COMPLETE (Status);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }

    if (!EventStatus)
    {
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }


    /* The Type must be either Fixed AcpiEvent or GPE */

    switch (Type)
    {

    case ACPI_EVENT_FIXED:

        /* Decode the Fixed AcpiEvent */

        switch (Event)
        {
        case ACPI_EVENT_PMTIMER:
            RegisterId = TMR_STS;
            break;

        case ACPI_EVENT_GLOBAL:
            RegisterId = GBL_STS;
            break;

        case ACPI_EVENT_POWER_BUTTON:
            RegisterId = PWRBTN_STS;
            break;

        case ACPI_EVENT_SLEEP_BUTTON:
            RegisterId = SLPBTN_STS;
            break;

        case ACPI_EVENT_RTC:
            RegisterId = RTC_STS;
            break;

        default:
            return_ACPI_STATUS (AE_BAD_PARAMETER);
            break;
        }

        /* Get the status of the requested fixed event */

        *EventStatus = AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, RegisterId);
        break;


    case ACPI_EVENT_GPE:

        /* Ensure that we have a valid GPE number */

        if ((Event > ACPI_GPE_MAX) ||
            (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID))
        {
            return_ACPI_STATUS (AE_BAD_PARAMETER);
        }


        /* Obtain status on the requested GPE number */

        AcpiHwGetGpeStatus (Event, EventStatus);
        break;


    default:
        Status = AE_BAD_PARAMETER;
    }

    return_ACPI_STATUS (Status);
}
Пример #4
0
ACPI_STATUS
AcpiGetEventStatus (
    UINT32                  Event,
    UINT32                  Type,
    ACPI_EVENT_STATUS       *EventStatus)
{
    ACPI_STATUS             Status = AE_OK;
    ACPI_GPE_EVENT_INFO     *GpeEventInfo;


    ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");


    if (!EventStatus)
    {
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }


    /* The Type must be either Fixed Event or GPE */

    switch (Type)
    {
    case ACPI_EVENT_FIXED:

        /* Decode the Fixed Event */

        if (Event > ACPI_EVENT_MAX)
        {
            return_ACPI_STATUS (AE_BAD_PARAMETER);
        }

        /* Get the status of the requested fixed event */

        Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
                        EventStatus, ACPI_MTX_LOCK);
        break;


    case ACPI_EVENT_GPE:

        /* Ensure that we have a valid GPE number */

        GpeEventInfo = AcpiEvGetGpeEventInfo (Event);
        if (!GpeEventInfo)
        {
            return_ACPI_STATUS (AE_BAD_PARAMETER);
        }

        /* Obtain status on the requested GPE number */

        Status = AcpiHwGetGpeStatus (Event, EventStatus);
        break;


    default:
        Status = AE_BAD_PARAMETER;
    }

    return_ACPI_STATUS (Status);
}