summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2005-12-14 04:15:44 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2005-12-14 04:15:44 +0000
commite12abecff749bbdc8343280ddb933f1898b65c67 (patch)
tree13461c2e75ce64d741d148c7ad79e95c20fa3fc7
parent68c5f5e065b27e47031bd71ea093c7133603af55 (diff)
Add AC device.
-rw-r--r--sys/dev/acpi/acpiac.c74
-rw-r--r--sys/dev/acpi/acpiac.h35
2 files changed, 109 insertions, 0 deletions
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 <marco@openbsd.org>
+ *
+ * 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 <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/bus.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpiac.h>
+
+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 <marco@openbsd.org>
+ *
+ * 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__ */