summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-01-10 13:36:58 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-01-10 13:36:58 +0000
commitf94392ccbaf3c8955688b433fec197eec6d5e66c (patch)
treea0080083f0be4acb356db578eb20c52c297b109f /sys/dev
parent67b32f0da7d3d367d523db68da1e450acc66af39 (diff)
Attach acpihpet only once. The matching code is changed because acpi bus
can be enumerated which means match routine should do the right thing and prevent further attachments. With input from kettenis, deraadt, miod; ok deraadt, kettenis
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpihpet.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpihpet.c b/sys/dev/acpi/acpihpet.c
index 96e9be987ba..6df201382a5 100644
--- a/sys/dev/acpi/acpihpet.c
+++ b/sys/dev/acpi/acpihpet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpihpet.c,v 1.12 2010/07/21 19:35:15 deraadt Exp $ */
+/* $OpenBSD: acpihpet.c,v 1.13 2011/01/10 13:36:57 mikeb Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -29,6 +29,8 @@
#include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h>
+int acpihpet_attached;
+
int acpihpet_match(struct device *, void *, void *);
void acpihpet_attach(struct device *, struct device *, void *);
int acpihpet_activate(struct device *, int);
@@ -87,9 +89,9 @@ acpihpet_match(struct device *parent, void *match, void *aux)
struct acpi_table_header *hdr;
/*
- * If we do not have a table, it is not us
+ * If we do not have a table, it is not us; attach only once
*/
- if (aaa->aaa_table == NULL)
+ if (acpihpet_attached || aaa->aaa_table == NULL)
return (0);
/*
@@ -170,6 +172,7 @@ acpihpet_attach(struct device *parent, struct device *self, void *aux)
hpet_timecounter.tc_name = sc->sc_dev.dv_xname;
tc_init(&hpet_timecounter);
#endif
+ acpihpet_attached++;
}
#ifdef __HAVE_TIMECOUNTER