summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGordon Willem Klok <gwk@cvs.openbsd.org>2007-05-29 08:22:15 +0000
committerGordon Willem Klok <gwk@cvs.openbsd.org>2007-05-29 08:22:15 +0000
commit00fb4c196a93edb62faa783eb4055d1b1b95055d (patch)
tree282229a6d02166605495eef38312937d09ce55c2 /sys
parentf3d4a8c6c9b8fafb2dc6c1cb04f51919541b093e (diff)
Add global variable apm_attached, machine dependant probe routine for ACPI
will check this flag durring probe, meaning that if the machine has APM ACPI will not attach. This should remove one obstacle on the road to enabling ACPI by default. ok marco, dreaadt, art, krw, art
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c38
-rw-r--r--sys/arch/i386/i386/apm.c9
2 files changed, 25 insertions, 22 deletions
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index b47aed995f9..3b3e6e9af4c 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.5 2006/11/29 11:16:25 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.6 2007/05/29 08:22:14 gwk Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -113,17 +113,25 @@ acpi_probe(struct device *parent, struct cfdata *match, struct acpi_attach_args
struct acpi_mem_map handle;
u_int8_t *ptr;
paddr_t ebda;
+#if NAPM > 0
+ extern int apm_attached;
+
+ if (apm_attached)
+ return (0);
+#endif
#if NBIOS > 0
- bios_memmap_t *im;
-
- /*
- * First look for ACPI entries in the BIOS memory map
- */
- for (im = bios_memmap; im->type != BIOS_MAP_END; im++)
- if (im->type == BIOS_MAP_ACPI) {
- if ((ptr = acpi_scan(&handle, im->addr, im->size)))
- goto havebase;
- }
+ {
+ bios_memmap_t *im;
+
+ /*
+ * First look for ACPI entries in the BIOS memory map
+ */
+ for (im = bios_memmap; im->type != BIOS_MAP_END; im++)
+ if (im->type == BIOS_MAP_ACPI) {
+ if ((ptr = acpi_scan(&handle, im->addr, im->size)))
+ goto havebase;
+ }
+ }
#endif
/*
@@ -156,14 +164,6 @@ havebase:
aaa->aaa_pbase = ptr - handle.va + handle.pa;
acpi_unmap(&handle);
-#ifdef notyet
- /*
- * Disable APM if we are using ACPI
- */
-#if NAPM > 0 && NBIOS > 0
- apm = NULL;
-#endif
-#endif
return (1);
}
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 404c19d0204..48c92d866b6 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.74 2007/03/19 09:29:33 art Exp $ */
+/* $OpenBSD: apm.c,v 1.75 2007/05/29 08:22:14 gwk Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -150,6 +150,7 @@ int apm_dobusy = 0;
int apm_doidle = 0;
int apm_bebatt = 0;
int apm_idle_called = 0;
+int apm_attached = 0;
struct {
u_int32_t entry;
@@ -355,7 +356,7 @@ apm_resume(struct apm_softc *sc, struct apmregs *regs)
/* lower bit in cx means pccard was powered down */
dopowerhooks(PWR_RESUME);
apm_record_event(sc, regs->bx);
-
+
/* acknowledge any rtc interrupt we may have missed */
rtcdrain(NULL);
@@ -903,8 +904,10 @@ apmattach(struct device *parent, struct device *self, void *aux)
if (apm_periodic_check(sc) == -1) {
apm_disconnect(sc);
apm_dobusy = apm_doidle = 0;
- } else
+ } else {
kthread_create_deferred(apm_thread_create, sc);
+ apm_attached = 1;
+ }
} else {
setgdt(GAPM32CODE_SEL, NULL, 0, 0, 0, 0, 0);
setgdt(GAPM16CODE_SEL, NULL, 0, 0, 0, 0, 0);