Add acpiec_bus_{read,write} and acpiec_get_handle, for use in other

device drivers.
This commit is contained in:
jmcneill 2007-12-21 21:22:54 +00:00
parent 89a3551a18
commit f5210660c0
2 changed files with 62 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_ec.c,v 1.47 2007/12/19 20:48:56 joerg Exp $ */
/* $NetBSD: acpi_ec.c,v 1.48 2007/12/21 21:22:54 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.47 2007/12/19 20:48:56 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.48 2007/12/21 21:22:54 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.47 2007/12/19 20:48:56 joerg Exp $");
#include <sys/bus.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpi_ecvar.h>
/* Maximum time to wait for global ACPI lock in ms */
#define EC_LOCK_TIMEOUT 5
@ -847,3 +848,23 @@ acpiec_gpe_handler(void *arg)
return 0;
}
ACPI_STATUS
acpiec_bus_read(device_t dv, u_int addr, ACPI_INTEGER *val, int width)
{
return acpiec_space_handler(ACPI_READ, addr, width * 8, val, dv, NULL);
}
ACPI_STATUS
acpiec_bus_write(device_t dv, u_int addr, ACPI_INTEGER val, int width)
{
return acpiec_space_handler(ACPI_WRITE, addr, width * 8, &val, dv, NULL);
}
ACPI_HANDLE
acpiec_get_handle(device_t dv)
{
struct acpiec_softc *sc = device_private(dv);
return sc->sc_ech;
}

39
sys/dev/acpi/acpi_ecvar.h Normal file
View File

@ -0,0 +1,39 @@
/* $NetBSD: acpi_ecvar.h,v 1.1 2007/12/21 21:22:54 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _HAVE_DEV_ACPI_ACPI_ECVAR_H
#define _HAVE_DEV_ACPI_ACPI_ECVAR_H
ACPI_STATUS acpiec_bus_read(device_t, u_int, ACPI_INTEGER *, int);
ACPI_STATUS acpiec_bus_write(device_t, u_int, ACPI_INTEGER, int);
ACPI_HANDLE acpiec_get_handle(device_t);
#endif /* !_HAVE_DEV_ACPI_ACPI_ECVAR_H */