Deleted Added
full compact
acpi_ec.c (80078) acpi_ec.c (82372)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/acpica/acpi_ec.c 80078 2001-07-21 10:24:37Z msmith $
27 * $FreeBSD: head/sys/dev/acpica/acpi_ec.c 82372 2001-08-26 22:50:15Z msmith $
28 */
29/******************************************************************************
30 *
31 * 1. Copyright Notice
32 *
33 * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
34 * reserved.
35 *

--- 326 unchanged lines hidden (view full) ---

362 sc = device_get_softc(dev);
363 bzero(sc, sizeof(*sc));
364 sc->ec_dev = dev;
365 sc->ec_handle = acpi_get_handle(dev);
366
367 /*
368 * Evaluate resources
369 */
28 */
29/******************************************************************************
30 *
31 * 1. Copyright Notice
32 *
33 * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
34 * reserved.
35 *

--- 326 unchanged lines hidden (view full) ---

362 sc = device_get_softc(dev);
363 bzero(sc, sizeof(*sc));
364 sc->ec_dev = dev;
365 sc->ec_handle = acpi_get_handle(dev);
366
367 /*
368 * Evaluate resources
369 */
370 DEBUG_PRINT(TRACE_RESOURCES, ("parsing EC resources\n"));
370 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "parsing EC resources\n"));
371 acpi_parse_resources(sc->ec_dev, sc->ec_handle, &acpi_res_parse_set);
372
373 /*
374 * Attach bus resources
375 */
376 sc->ec_data_rid = 0;
377 if ((sc->ec_data_res = bus_alloc_resource(sc->ec_dev, SYS_RES_IOPORT, &sc->ec_data_rid,
378 0, ~0, 1, RF_ACTIVE)) == NULL) {

--- 13 unchanged lines hidden (view full) ---

392 sc->ec_csr_handle = rman_get_bushandle(sc->ec_csr_res);
393
394 /*
395 * Install GPE handler
396 *
397 * Evaluate the _GPE method to find the GPE bit used by the EC to signal
398 * status (SCI).
399 */
371 acpi_parse_resources(sc->ec_dev, sc->ec_handle, &acpi_res_parse_set);
372
373 /*
374 * Attach bus resources
375 */
376 sc->ec_data_rid = 0;
377 if ((sc->ec_data_res = bus_alloc_resource(sc->ec_dev, SYS_RES_IOPORT, &sc->ec_data_rid,
378 0, ~0, 1, RF_ACTIVE)) == NULL) {

--- 13 unchanged lines hidden (view full) ---

392 sc->ec_csr_handle = rman_get_bushandle(sc->ec_csr_res);
393
394 /*
395 * Install GPE handler
396 *
397 * Evaluate the _GPE method to find the GPE bit used by the EC to signal
398 * status (SCI).
399 */
400 DEBUG_PRINT(TRACE_RESOURCES, ("attaching GPE\n"));
400 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "attaching GPE\n"));
401 if ((Status = acpi_EvaluateInteger(sc->ec_handle, "_GPE", &sc->ec_gpebit)) != AE_OK) {
402 device_printf(dev, "can't evaluate _GPE - %s\n", AcpiFormatException(Status));
403 return_VALUE(ENXIO);
404 }
405
406 /*
407 * Install a handler for this EC's GPE bit. Note that EC SCIs are
408 * treated as both edge- and level-triggered interrupts; in other words

--- 7 unchanged lines hidden (view full) ---

416 device_printf(dev, "can't install GPE handler for %s - %s\n",
417 acpi_name(sc->ec_handle), AcpiFormatException(Status));
418 return_VALUE(ENXIO);
419 }
420
421 /*
422 * Install address space handler
423 */
401 if ((Status = acpi_EvaluateInteger(sc->ec_handle, "_GPE", &sc->ec_gpebit)) != AE_OK) {
402 device_printf(dev, "can't evaluate _GPE - %s\n", AcpiFormatException(Status));
403 return_VALUE(ENXIO);
404 }
405
406 /*
407 * Install a handler for this EC's GPE bit. Note that EC SCIs are
408 * treated as both edge- and level-triggered interrupts; in other words

--- 7 unchanged lines hidden (view full) ---

416 device_printf(dev, "can't install GPE handler for %s - %s\n",
417 acpi_name(sc->ec_handle), AcpiFormatException(Status));
418 return_VALUE(ENXIO);
419 }
420
421 /*
422 * Install address space handler
423 */
424 DEBUG_PRINT(TRACE_RESOURCES, ("attaching address space handler\n"));
424 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "attaching address space handler\n"));
425 if ((Status = AcpiInstallAddressSpaceHandler(sc->ec_handle, ACPI_ADR_SPACE_EC,
426 EcSpaceHandler, EcSpaceSetup, sc)) != AE_OK) {
427 device_printf(dev, "can't install address space handler for %s - %s\n",
428 acpi_name(sc->ec_handle), AcpiFormatException(Status));
429 panic("very suck");
430 return_VALUE(ENXIO);
431 }
425 if ((Status = AcpiInstallAddressSpaceHandler(sc->ec_handle, ACPI_ADR_SPACE_EC,
426 EcSpaceHandler, EcSpaceSetup, sc)) != AE_OK) {
427 device_printf(dev, "can't install address space handler for %s - %s\n",
428 acpi_name(sc->ec_handle), AcpiFormatException(Status));
429 panic("very suck");
430 return_VALUE(ENXIO);
431 }
432 DEBUG_PRINT(TRACE_RESOURCES, ("attach complete\n"));
432 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "attach complete\n"));
433
434 return_VALUE(0);
435}
436
437static void
438EcGpeQueryHandler(void *Context)
439{
440 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;

--- 377 unchanged lines hidden ---
433
434 return_VALUE(0);
435}
436
437static void
438EcGpeQueryHandler(void *Context)
439{
440 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;

--- 377 unchanged lines hidden ---