From ffd9e167097620bb10be8a6bf0e276b6708e3514 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 29 Jan 2009 21:17:50 +0000 Subject: Some of the latest macppc laptops with no adb subsystem at all, spontaneously powerdown if we try to issue pmu commands. Skip these if no adb device appears in the device tree. Adapted from NetBSD. --- sys/arch/macppc/dev/adb.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c index 600f1cbe462..c0abe9406e8 100644 --- a/sys/arch/macppc/dev/adb.c +++ b/sys/arch/macppc/dev/adb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adb.c,v 1.27 2007/04/23 16:27:20 deraadt Exp $ */ +/* $OpenBSD: adb.c,v 1.28 2009/01/29 21:17:49 miod Exp $ */ /* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */ /* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */ @@ -1665,7 +1665,8 @@ adbattach(struct device *parent, struct device *self, void *aux) } adb_polling = 1; - adb_reinit(); + if (!adbempty) + adb_reinit(); mac_intr_establish(parent, ca->ca_intr[0], IST_LEVEL, IPL_HIGH, adb_intr, sc, sc->sc_dev.dv_xname); @@ -1678,7 +1679,10 @@ adbattach(struct device *parent, struct device *self, void *aux) if (adb_debug) printf("adb: done with adb_reinit\n"); #endif - totaladbs = count_adbs(); + if (adbempty) + totaladbs = 0; + else + totaladbs = count_adbs(); printf(" irq %d: %s, %d target%s\n", ca->ca_intr[0], ca->ca_name, totaladbs, (totaladbs == 1) ? "" : "s"); @@ -1715,12 +1719,14 @@ adbattach(struct device *parent, struct device *self, void *aux) } } - if (adbHardware == ADB_HW_CUDA) - adb_cuda_fileserver_mode(); - if (adbHardware == ADB_HW_PMU) - pmu_fileserver_mode(1); + if (!adbempty) { + if (adbHardware == ADB_HW_CUDA) + adb_cuda_fileserver_mode(); + if (adbHardware == ADB_HW_PMU) + pmu_fileserver_mode(1); - if (adbHardware == ADB_HW_CUDA) - adb_cuda_autopoll(); - adb_polling = 0; + if (adbHardware == ADB_HW_CUDA) + adb_cuda_autopoll(); + adb_polling = 0; + } } -- cgit v1.2.3