From c16e7cd67527e91a2203104c6e45762b1ee5f197 Mon Sep 17 00:00:00 2001 From: pirofti Date: Sat, 19 Jul 2014 18:01:23 +0000 Subject: [PATCH] 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@ --- sys/arch/loongson/dev/apm.c | 7 ++++++- sys/arch/loongson/loongson/machdep.c | 6 ++++-- 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 #include +#include /* pci_dopm */ + #include #include @@ -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) { -- 2.20.1