From e12abecff749bbdc8343280ddb933f1898b65c67 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Wed, 14 Dec 2005 04:15:44 +0000 Subject: Add AC device. --- sys/dev/acpi/acpiac.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/acpi/acpiac.h | 35 ++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 sys/dev/acpi/acpiac.c create mode 100644 sys/dev/acpi/acpiac.h diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c new file mode 100644 index 00000000000..f5956126399 --- /dev/null +++ b/sys/dev/acpi/acpiac.c @@ -0,0 +1,74 @@ +/* $OpenBSD: acpiac.c,v 1.1 2005/12/14 04:15:43 marco Exp $ */ +/* + * Copyright (c) 2005 Marco Peereboom + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +#include + +#include +#include +#include + +int acpiac_match(struct device *, void *, void *); +void acpiac_attach(struct device *, struct device *, void *); + +struct acpiac_softc { + struct device sc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; +}; + +struct cfattach acpiac_ca = { + sizeof(struct acpiac_softc), acpiac_match, acpiac_attach +}; + +struct cfdriver acpiac_cd = { + NULL, "acpiac", DV_DULL +}; + +int +acpiac_match(struct device *parent, void *match, void *aux) +{ + struct acpi_attach_args *aa = aux; + struct cfdata *cf = match; + + /* sanity */ + if (aa->aaa_name == NULL || + strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || + aa->aaa_table != NULL) + return (0); + + return (1); +} + +void +acpiac_attach(struct device *parent, struct device *self, void *aux) +{ +/* + struct acpiac_softc *sc = (struct acpiac_softc *) self; + struct acpi_softc *psc = (struct acpi_softc *) parent; + struct acpi_attach_args *aa = aux; + bus_addr_t address; + bus_size_t size; +*/ + + printf("\n"); +} diff --git a/sys/dev/acpi/acpiac.h b/sys/dev/acpi/acpiac.h new file mode 100644 index 00000000000..68356b203b9 --- /dev/null +++ b/sys/dev/acpi/acpiac.h @@ -0,0 +1,35 @@ +/* $OpenBSD: acpiac.h,v 1.1 2005/12/14 04:15:43 marco Exp $ */ +/* + * Copyright (c) 2005 Marco Peereboom + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef __DEV_ACPI_ACPIAC_H__ +#define __DEV_ACPI_ACPIAC_H__ + +/* + * _PSR (Power Source) + * Arguments: none + * Results : DWORD status + */ +#define PSR_ONLINE 0x00 +#define PSR_OFFLINE 0x01 + +/* + * _PCL (Power Consumer List) + * Arguments: none + * Results : LIST of Power Class pointers + */ + +#endif /* __DEV_ACPI_ACPIAC_H__ */ -- cgit v1.2.3