summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikeb <mikeb@openbsd.org>2011-01-10 13:36:57 +0000
committermikeb <mikeb@openbsd.org>2011-01-10 13:36:57 +0000
commit7a772371d4646dec0bdd1fb81b555af9acf58d77 (patch)
tree49b208c440e1bb152b4c6ed37b10feb6acc8da00
parenthave "non quiet" mode for pkg_info -r show something... (diff)
downloadwireguard-openbsd-7a772371d4646dec0bdd1fb81b555af9acf58d77.tar.xz
wireguard-openbsd-7a772371d4646dec0bdd1fb81b555af9acf58d77.zip
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
-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