View | Details | Raw Unified | Return to bug 162859 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/acpica/acpi_ec.c (-16 / +13 lines)
Lines 620-626 EcGpeQueryHandler(void *Context) Link Here
620
    struct acpi_ec_softc	*sc = (struct acpi_ec_softc *)Context;
620
    struct acpi_ec_softc	*sc = (struct acpi_ec_softc *)Context;
621
    UINT8			Data;
621
    UINT8			Data;
622
    ACPI_STATUS			Status;
622
    ACPI_STATUS			Status;
623
    int				retry, sci_enqueued;
623
    int				retry;
624
    char			qxx[5];
624
    char			qxx[5];
625
625
626
    ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
626
    ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
Lines 631-637 EcGpeQueryHandler(void *Context) Link Here
631
    if (ACPI_FAILURE(Status)) {
631
    if (ACPI_FAILURE(Status)) {
632
	device_printf(sc->ec_dev, "GpeQuery lock error: %s\n",
632
	device_printf(sc->ec_dev, "GpeQuery lock error: %s\n",
633
	    AcpiFormatException(Status));
633
	    AcpiFormatException(Status));
634
	return;
634
	goto finish;
635
    }
635
    }
636
636
637
    /*
637
    /*
Lines 641-647 EcGpeQueryHandler(void *Context) Link Here
641
     * that may arise from running the query from causing another query
641
     * that may arise from running the query from causing another query
642
     * to be queued, we clear the pending flag only after running it.
642
     * to be queued, we clear the pending flag only after running it.
643
     */
643
     */
644
    sci_enqueued = sc->ec_sci_pend;
645
    for (retry = 0; retry < 2; retry++) {
644
    for (retry = 0; retry < 2; retry++) {
646
	Status = EcCommand(sc, EC_COMMAND_QUERY);
645
	Status = EcCommand(sc, EC_COMMAND_QUERY);
647
	if (ACPI_SUCCESS(Status))
646
	if (ACPI_SUCCESS(Status))
Lines 657-663 EcGpeQueryHandler(void *Context) Link Here
657
	EcUnlock(sc);
656
	EcUnlock(sc);
658
	device_printf(sc->ec_dev, "GPE query failed: %s\n",
657
	device_printf(sc->ec_dev, "GPE query failed: %s\n",
659
	    AcpiFormatException(Status));
658
	    AcpiFormatException(Status));
660
	return;
659
	goto finish;
661
    }
660
    }
662
    Data = EC_GET_DATA(sc);
661
    Data = EC_GET_DATA(sc);
663
662
Lines 671-677 EcGpeQueryHandler(void *Context) Link Here
671
    /* Ignore the value for "no outstanding event". (13.3.5) */
670
    /* Ignore the value for "no outstanding event". (13.3.5) */
672
    CTR2(KTR_ACPI, "ec query ok,%s running _Q%02X", Data ? "" : " not", Data);
671
    CTR2(KTR_ACPI, "ec query ok,%s running _Q%02X", Data ? "" : " not", Data);
673
    if (Data == 0)
672
    if (Data == 0)
674
	return;
673
	goto finish;
675
674
676
    /* Evaluate _Qxx to respond to the controller. */
675
    /* Evaluate _Qxx to respond to the controller. */
677
    snprintf(qxx, sizeof(qxx), "_Q%02X", Data);
676
    snprintf(qxx, sizeof(qxx), "_Q%02X", Data);
Lines 682-694 EcGpeQueryHandler(void *Context) Link Here
682
	    qxx, AcpiFormatException(Status));
681
	    qxx, AcpiFormatException(Status));
683
    }
682
    }
684
683
685
    /* Reenable runtime GPE if its execution was deferred. */
684
finish:
686
    if (sci_enqueued) {
685
    /* Reenable runtime GPE. */
687
	Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit);
686
    Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit);
688
	if (ACPI_FAILURE(Status))
687
    if (ACPI_FAILURE(Status))
689
	    device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s\n",
688
	device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s\n",
690
		AcpiFormatException(Status));
689
	    AcpiFormatException(Status));
691
    }
692
}
690
}
693
691
694
/*
692
/*
Lines 722-734 EcGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumb Link Here
722
    if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
720
    if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
723
	CTR0(KTR_ACPI, "ec gpe queueing query handler");
721
	CTR0(KTR_ACPI, "ec gpe queueing query handler");
724
	Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
722
	Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
725
	if (ACPI_SUCCESS(Status)) {
723
	if (ACPI_SUCCESS(Status))
726
	    sc->ec_sci_pend = TRUE;
724
	    sc->ec_sci_pend = TRUE;
727
	    return (0);
725
	else
728
	} else
729
	    printf("EcGpeHandler: queuing GPE query handler failed\n");
726
	    printf("EcGpeHandler: queuing GPE query handler failed\n");
730
    }
727
    }
731
    return (ACPI_REENABLE_GPE);
728
    return (0);
732
}
729
}
733
730
734
static ACPI_STATUS
731
static ACPI_STATUS

Return to bug 162859