summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpirofti <pirofti@openbsd.org>2014-07-19 18:01:23 +0000
committerpirofti <pirofti@openbsd.org>2014-07-19 18:01:23 +0000
commitc16e7cd67527e91a2203104c6e45762b1ee5f197 (patch)
tree62e019e2598c0fad7db636ca28e26f968280c98b
parentremove disabled main hook; we use phdr now; ok bcook (diff)
downloadwireguard-openbsd-c16e7cd67527e91a2203104c6e45762b1ee5f197.tar.xz
wireguard-openbsd-c16e7cd67527e91a2203104c6e45762b1ee5f197.zip
Bring back pci_dopm, but disable it before powerdown.
This fixes both the Lemote reboot issue and the USB issue on the Gdium's that miod@ spotted. Suggested by kettenis@, thanks! Okay miod@
-rw-r--r--sys/arch/loongson/dev/apm.c7
-rw-r--r--sys/arch/loongson/loongson/machdep.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c
index 4534e871215..4693d4cf18d 100644
--- a/sys/arch/loongson/dev/apm.c
+++ b/sys/arch/loongson/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.22 2014/07/19 12:54:09 pirofti Exp $ */
+/* $OpenBSD: apm.c,v 1.23 2014/07/19 18:01:23 pirofti Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -51,6 +51,8 @@
#include <machine/cpu.h>
#include <machine/apmvar.h>
+#include <dev/pci/pcivar.h> /* pci_dopm */
+
#include <dev/wscons/wsdisplayvar.h>
#include <loongson/dev/kb3310var.h>
@@ -132,6 +134,9 @@ apmmatch(struct device *parent, void *match, void *aux)
void
apmattach(struct device *parent, struct device *self, void *aux)
{
+ /* Enable PCI Power Management. */
+ pci_dopm = 1;
+
printf("\n");
}
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 29c41a1b40d..60f2a66f214 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.56 2014/07/13 22:53:39 uebayasi Exp $ */
+/* $OpenBSD: machdep.c,v 1.57 2014/07/19 18:01:23 pirofti Exp $ */
/*
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
@@ -936,8 +936,10 @@ boot(int howto)
haltsys:
doshutdownhooks();
mainbus = device_mainbus();
- if (mainbus != NULL)
+ if (mainbus != NULL) {
+ pci_dopm = 0;
config_suspend(mainbus, DVACT_POWERDOWN);
+ }
if (howto & RB_HALT) {
if (howto & RB_POWERDOWN) {