Deleted Added
full compact
acpi_ec.c (91122) acpi_ec.c (96926)
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 91122 2002-02-23 05:26:31Z msmith $
27 * $FreeBSD: head/sys/dev/acpica/acpi_ec.c 96926 2002-05-19 06:16:47Z peter $
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 *

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

317 * space handler to catch possible attempts to access EC space before
318 * we have a real driver instance in place.
319 * We're not really an identify routine, but because we get called
320 * before most other things, this works out OK.
321 */
322static void
323acpi_ec_identify(driver_t driver, device_t bus)
324{
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 *

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

317 * space handler to catch possible attempts to access EC space before
318 * we have a real driver instance in place.
319 * We're not really an identify routine, but because we get called
320 * before most other things, this works out OK.
321 */
322static void
323acpi_ec_identify(driver_t driver, device_t bus)
324{
325 ACPI_FUNCTION_TRACE(__func__);
325 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
326
327 /* XXX implement - need an ACPI 2.0 system to test this */
328
329 return_VOID;
330}
331
332/*
333 * We could setup resources in the probe routine in order to have them printed

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

353
354static int
355acpi_ec_attach(device_t dev)
356{
357 struct acpi_ec_softc *sc;
358 ACPI_STATUS Status;
359 int errval = 0;
360
326
327 /* XXX implement - need an ACPI 2.0 system to test this */
328
329 return_VOID;
330}
331
332/*
333 * We could setup resources in the probe routine in order to have them printed

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

353
354static int
355acpi_ec_attach(device_t dev)
356{
357 struct acpi_ec_softc *sc;
358 ACPI_STATUS Status;
359 int errval = 0;
360
361 ACPI_FUNCTION_TRACE(__func__);
361 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
362
363 /*
364 * Fetch/initialise softc
365 */
366 sc = device_get_softc(dev);
367 bzero(sc, sizeof(*sc));
368 sc->ec_dev = dev;
369 sc->ec_handle = acpi_get_handle(dev);

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

452static void
453EcGpeQueryHandler(void *Context)
454{
455 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
456 UINT8 Data;
457 ACPI_STATUS Status;
458 char qxx[5];
459
362
363 /*
364 * Fetch/initialise softc
365 */
366 sc = device_get_softc(dev);
367 bzero(sc, sizeof(*sc));
368 sc->ec_dev = dev;
369 sc->ec_handle = acpi_get_handle(dev);

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

452static void
453EcGpeQueryHandler(void *Context)
454{
455 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
456 UINT8 Data;
457 ACPI_STATUS Status;
458 char qxx[5];
459
460 ACPI_FUNCTION_TRACE(__func__);
460 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
461
462 for (;;) {
463
464 /*
465 * Check EC_SCI.
466 *
467 * Bail out if the EC_SCI bit of the status register is not set.
468 * Note that this function should only be called when

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

543 }
544 return;
545}
546
547static ACPI_STATUS
548EcSpaceSetup(ACPI_HANDLE Region, UINT32 Function, void *Context, void **RegionContext)
549{
550
461
462 for (;;) {
463
464 /*
465 * Check EC_SCI.
466 *
467 * Bail out if the EC_SCI bit of the status register is not set.
468 * Note that this function should only be called when

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

543 }
544 return;
545}
546
547static ACPI_STATUS
548EcSpaceSetup(ACPI_HANDLE Region, UINT32 Function, void *Context, void **RegionContext)
549{
550
551 ACPI_FUNCTION_TRACE(__func__);
551 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
552
553 /*
554 * Just pass the context through, there's nothing to do here.
555 */
556 *RegionContext = Context;
557
558 return_ACPI_STATUS(AE_OK);
559}
560
561static ACPI_STATUS
562EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, ACPI_INTEGER *Value,
563 void *Context, void *RegionContext)
564{
565 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
566 ACPI_STATUS Status = AE_OK;
567 EC_REQUEST EcRequest;
568 int i;
569
552
553 /*
554 * Just pass the context through, there's nothing to do here.
555 */
556 *RegionContext = Context;
557
558 return_ACPI_STATUS(AE_OK);
559}
560
561static ACPI_STATUS
562EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, ACPI_INTEGER *Value,
563 void *Context, void *RegionContext)
564{
565 struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
566 ACPI_STATUS Status = AE_OK;
567 EC_REQUEST EcRequest;
568 int i;
569
570 ACPI_FUNCTION_TRACE_U32(__func__, (UINT32)Address);
570 ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address);
571
572 if ((Address > 0xFF) || (width % 8 != 0) || (Value == NULL) || (Context == NULL))
573 return_ACPI_STATUS(AE_BAD_PARAMETER);
574
575 switch (Function) {
576 case ACPI_READ:
577 EcRequest.Command = EC_COMMAND_READ;
578 EcRequest.Address = Address;

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

610 * Wait for an event interrupt for a specific condition.
611 */
612static ACPI_STATUS
613EcWaitEventIntr(struct acpi_ec_softc *sc, EC_EVENT Event)
614{
615 EC_STATUS EcStatus;
616 int i;
617
571
572 if ((Address > 0xFF) || (width % 8 != 0) || (Value == NULL) || (Context == NULL))
573 return_ACPI_STATUS(AE_BAD_PARAMETER);
574
575 switch (Function) {
576 case ACPI_READ:
577 EcRequest.Command = EC_COMMAND_READ;
578 EcRequest.Address = Address;

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

610 * Wait for an event interrupt for a specific condition.
611 */
612static ACPI_STATUS
613EcWaitEventIntr(struct acpi_ec_softc *sc, EC_EVENT Event)
614{
615 EC_STATUS EcStatus;
616 int i;
617
618 ACPI_FUNCTION_TRACE_U32(__func__, (UINT32)Event);
618 ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Event);
619
620 /* XXX this should test whether interrupts are available some other way */
621 if(cold)
622 return_ACPI_STATUS(EcWaitEvent(sc, Event));
623
624 if (!EcIsLocked(sc))
625 ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
626 "EcWaitEventIntr called without EC lock!\n");

--- 219 unchanged lines hidden ---
619
620 /* XXX this should test whether interrupts are available some other way */
621 if(cold)
622 return_ACPI_STATUS(EcWaitEvent(sc, Event));
623
624 if (!EcIsLocked(sc))
625 ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
626 "EcWaitEventIntr called without EC lock!\n");

--- 219 unchanged lines hidden ---