summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2005-12-13 07:21:48 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2005-12-13 07:21:48 +0000
commitdb383b381ab2e5462c5cdc38905252fe86d8f768 (patch)
treeba927e0e19747eaff14fec8447e0ac65e4bb332b
parentf1c3e1543334e62723b596b3e7529d51f8ae559e (diff)
Add battery device.
-rw-r--r--sys/dev/acpi/acpibat.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c
new file mode 100644
index 00000000000..a3074789b25
--- /dev/null
+++ b/sys/dev/acpi/acpibat.c
@@ -0,0 +1,73 @@
+/* $OpenBSD: acpibat.c,v 1.1 2005/12/13 07:21:47 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>
+
+int acpibat_match(struct device *, void *, void *);
+void acpibat_attach(struct device *, struct device *, void *);
+
+struct acpibat_softc {
+ struct device sc_dev;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+};
+
+struct cfattach acpibat_ca = {
+ sizeof(struct acpibat_softc), acpibat_match, acpibat_attach
+};
+
+struct cfdriver acpibat_cd = {
+ NULL, "acpibat", DV_DULL
+};
+
+int
+acpibat_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
+acpibat_attach(struct device *parent, struct device *self, void *aux)
+{
+/*
+ struct acpibat_softc *sc = (struct acpibat_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");
+}