version 1.59, 2010/01/18 18:36:49 |
version 1.59.2.1, 2010/04/30 14:43:05 |
|
|
__KERNEL_RCSID(0, "$NetBSD$"); |
__KERNEL_RCSID(0, "$NetBSD$"); |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/systm.h> |
#include <sys/callout.h> |
#include <sys/condvar.h> |
#include <sys/condvar.h> |
#include <sys/device.h> |
#include <sys/device.h> |
#include <sys/kernel.h> |
#include <sys/kernel.h> |
#include <sys/kthread.h> |
#include <sys/kthread.h> |
#include <sys/mutex.h> |
#include <sys/mutex.h> |
|
#include <sys/systm.h> |
#include <sys/bus.h> |
|
|
|
#include <dev/acpi/acpireg.h> |
#include <dev/acpi/acpireg.h> |
#include <dev/acpi/acpivar.h> |
#include <dev/acpi/acpivar.h> |
Line 123 struct acpiec_softc { |
|
Line 122 struct acpiec_softc { |
|
ACPI_HANDLE sc_ech; |
ACPI_HANDLE sc_ech; |
|
|
ACPI_HANDLE sc_gpeh; |
ACPI_HANDLE sc_gpeh; |
UINT8 sc_gpebit; |
uint8_t sc_gpebit; |
|
|
bus_space_tag_t sc_data_st; |
bus_space_tag_t sc_data_st; |
bus_space_handle_t sc_data_sh; |
bus_space_handle_t sc_data_sh; |
Line 132 struct acpiec_softc { |
|
Line 131 struct acpiec_softc { |
|
bus_space_handle_t sc_csr_sh; |
bus_space_handle_t sc_csr_sh; |
|
|
bool sc_need_global_lock; |
bool sc_need_global_lock; |
UINT32 sc_global_lock; |
uint32_t sc_global_lock; |
|
|
kmutex_t sc_mtx, sc_access_mtx; |
kmutex_t sc_mtx, sc_access_mtx; |
kcondvar_t sc_cv, sc_cv_sci; |
kcondvar_t sc_cv, sc_cv_sci; |
Line 150 static int acpiec_match(device_t, cfdata |
|
Line 149 static int acpiec_match(device_t, cfdata |
|
static void acpiec_attach(device_t, device_t, void *); |
static void acpiec_attach(device_t, device_t, void *); |
|
|
static void acpiec_common_attach(device_t, device_t, ACPI_HANDLE, |
static void acpiec_common_attach(device_t, device_t, ACPI_HANDLE, |
bus_addr_t, bus_addr_t, ACPI_HANDLE, uint8_t); |
bus_space_tag_t, bus_addr_t, bus_space_tag_t, bus_addr_t, |
|
ACPI_HANDLE, uint8_t); |
|
|
static bool acpiec_suspend(device_t, pmf_qual_t); |
static bool acpiec_suspend(device_t, const pmf_qual_t *); |
static bool acpiec_resume(device_t, pmf_qual_t); |
static bool acpiec_resume(device_t, const pmf_qual_t *); |
static bool acpiec_shutdown(device_t, int); |
static bool acpiec_shutdown(device_t, int); |
|
|
static bool acpiec_parse_gpe_package(device_t, ACPI_HANDLE, |
static bool acpiec_parse_gpe_package(device_t, ACPI_HANDLE, |
Line 161 static bool acpiec_parse_gpe_package(dev |
|
Line 161 static bool acpiec_parse_gpe_package(dev |
|
|
|
static void acpiec_callout(void *); |
static void acpiec_callout(void *); |
static void acpiec_gpe_query(void *); |
static void acpiec_gpe_query(void *); |
static UINT32 acpiec_gpe_handler(void *); |
static uint32_t acpiec_gpe_handler(void *); |
static ACPI_STATUS acpiec_space_setup(ACPI_HANDLE, UINT32, void *, void **); |
static ACPI_STATUS acpiec_space_setup(ACPI_HANDLE, uint32_t, void *, void **); |
static ACPI_STATUS acpiec_space_handler(UINT32, ACPI_PHYSICAL_ADDRESS, |
static ACPI_STATUS acpiec_space_handler(uint32_t, ACPI_PHYSICAL_ADDRESS, |
UINT32, ACPI_INTEGER *, void *, void *); |
uint32_t, ACPI_INTEGER *, void *, void *); |
|
|
static void acpiec_gpe_state_machine(device_t); |
static void acpiec_gpe_state_machine(device_t); |
|
|
Line 190 acpiecdt_find(device_t parent, ACPI_HAND |
|
Line 190 acpiecdt_find(device_t parent, ACPI_HAND |
|
|
|
if (ecdt->Control.BitWidth != 8 || ecdt->Data.BitWidth != 8) { |
if (ecdt->Control.BitWidth != 8 || ecdt->Data.BitWidth != 8) { |
aprint_error_dev(parent, |
aprint_error_dev(parent, |
"ECDT register width invalid (%d/%d)\n", |
"ECDT register width invalid (%u/%u)\n", |
ecdt->Control.BitWidth, ecdt->Data.BitWidth); |
ecdt->Control.BitWidth, ecdt->Data.BitWidth); |
return false; |
return false; |
} |
} |
Line 226 acpiecdt_match(device_t parent, cfdata_t |
|
Line 226 acpiecdt_match(device_t parent, cfdata_t |
|
static void |
static void |
acpiecdt_attach(device_t parent, device_t self, void *aux) |
acpiecdt_attach(device_t parent, device_t self, void *aux) |
{ |
{ |
|
struct acpibus_attach_args *aa = aux; |
ACPI_HANDLE ec_handle; |
ACPI_HANDLE ec_handle; |
bus_addr_t cmd_reg, data_reg; |
bus_addr_t cmd_reg, data_reg; |
uint8_t gpebit; |
uint8_t gpebit; |
Line 236 acpiecdt_attach(device_t parent, device_ |
|
Line 237 acpiecdt_attach(device_t parent, device_ |
|
aprint_naive("\n"); |
aprint_naive("\n"); |
aprint_normal(": ACPI Embedded Controller via ECDT\n"); |
aprint_normal(": ACPI Embedded Controller via ECDT\n"); |
|
|
acpiec_common_attach(parent, self, ec_handle, cmd_reg, data_reg, |
acpiec_common_attach(parent, self, ec_handle, aa->aa_iot, cmd_reg, |
NULL, gpebit); |
aa->aa_iot, data_reg, NULL, gpebit); |
} |
} |
|
|
static int |
static int |
Line 291 acpiec_attach(device_t parent, device_t |
|
Line 292 acpiec_attach(device_t parent, device_t |
|
} |
} |
|
|
acpiec_common_attach(parent, self, aa->aa_node->ad_handle, |
acpiec_common_attach(parent, self, aa->aa_node->ad_handle, |
io1->ar_base, io0->ar_base, gpe_handle, gpebit); |
aa->aa_iot, io1->ar_base, aa->aa_iot, io0->ar_base, |
|
gpe_handle, gpebit); |
|
|
free_res: |
free_res: |
acpi_resource_cleanup(&ec_res); |
acpi_resource_cleanup(&ec_res); |
|
|
|
|
static void |
static void |
acpiec_common_attach(device_t parent, device_t self, |
acpiec_common_attach(device_t parent, device_t self, |
ACPI_HANDLE ec_handle, bus_addr_t cmd_reg, bus_addr_t data_reg, |
ACPI_HANDLE ec_handle, bus_space_tag_t cmdt, bus_addr_t cmd_reg, |
|
bus_space_tag_t datat, bus_addr_t data_reg, |
ACPI_HANDLE gpe_handle, uint8_t gpebit) |
ACPI_HANDLE gpe_handle, uint8_t gpebit) |
{ |
{ |
struct acpiec_softc *sc = device_private(self); |
struct acpiec_softc *sc = device_private(self); |
ACPI_STATUS rv; |
ACPI_STATUS rv; |
ACPI_INTEGER val; |
ACPI_INTEGER val; |
|
|
|
sc->sc_csr_st = cmdt; |
|
sc->sc_data_st = datat; |
|
|
sc->sc_ech = ec_handle; |
sc->sc_ech = ec_handle; |
sc->sc_gpeh = gpe_handle; |
sc->sc_gpeh = gpe_handle; |
sc->sc_gpebit = gpebit; |
sc->sc_gpebit = gpebit; |
|
|
} |
} |
|
|
static bool |
static bool |
acpiec_suspend(device_t dv, pmf_qual_t qual) |
acpiec_suspend(device_t dv, const pmf_qual_t *qual) |
{ |
{ |
acpiec_cold = true; |
acpiec_cold = true; |
|
|
Line 407 acpiec_suspend(device_t dv, pmf_qual_t q |
|
Line 413 acpiec_suspend(device_t dv, pmf_qual_t q |
|
} |
} |
|
|
static bool |
static bool |
acpiec_resume(device_t dv, pmf_qual_t qual) |
acpiec_resume(device_t dv, const pmf_qual_t *qual) |
{ |
{ |
acpiec_cold = false; |
acpiec_cold = false; |
|
|
Line 505 acpiec_write_command(struct acpiec_softc |
|
Line 511 acpiec_write_command(struct acpiec_softc |
|
} |
} |
|
|
static ACPI_STATUS |
static ACPI_STATUS |
acpiec_space_setup(ACPI_HANDLE region, UINT32 func, void *arg, |
acpiec_space_setup(ACPI_HANDLE region, uint32_t func, void *arg, |
void **region_arg) |
void **region_arg) |
{ |
{ |
if (func == ACPI_REGION_DEACTIVATE) |
if (func == ACPI_REGION_DEACTIVATE) |
|
|
} |
} |
|
|
static ACPI_STATUS |
static ACPI_STATUS |
acpiec_space_handler(UINT32 func, ACPI_PHYSICAL_ADDRESS paddr, |
acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr, |
UINT32 width, ACPI_INTEGER *value, void *arg, void *region_arg) |
uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg) |
{ |
{ |
device_t dv; |
device_t dv; |
struct acpiec_softc *sc; |
struct acpiec_softc *sc; |
Line 850 acpiec_callout(void *arg) |
|
Line 856 acpiec_callout(void *arg) |
|
mutex_exit(&sc->sc_mtx); |
mutex_exit(&sc->sc_mtx); |
} |
} |
|
|
static UINT32 |
static uint32_t |
acpiec_gpe_handler(void *arg) |
acpiec_gpe_handler(void *arg) |
{ |
{ |
device_t dv = arg; |
device_t dv = arg; |