Wed Apr 17 07:47:48 2024 UTC (22d)
turn LEDs off when shutting down


(macallan)
diff -r1.20 -r1.21 src/sys/arch/hppa/hppa/machdep.c

cvs diff -r1.20 -r1.21 src/sys/arch/hppa/hppa/machdep.c (expand / switch to unified diff)

--- src/sys/arch/hppa/hppa/machdep.c 2024/03/05 14:15:32 1.20
+++ src/sys/arch/hppa/hppa/machdep.c 2024/04/17 07:47:48 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.20 2024/03/05 14:15:32 thorpej Exp $ */ 1/* $NetBSD: machdep.c,v 1.21 2024/04/17 07:47:48 macallan Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matthew Fredette. 8 * by Matthew Fredette.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -48,27 +48,27 @@ @@ -48,27 +48,27 @@
48 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 48 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 49 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 50 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
51 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 51 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
55 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 55 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
56 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 56 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
57 * THE POSSIBILITY OF SUCH DAMAGE. 57 * THE POSSIBILITY OF SUCH DAMAGE.
58 */ 58 */
59 59
60#include <sys/cdefs.h> 60#include <sys/cdefs.h>
61__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2024/03/05 14:15:32 thorpej Exp $"); 61__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.21 2024/04/17 07:47:48 macallan Exp $");
62 62
63#include "opt_cputype.h" 63#include "opt_cputype.h"
64#include "opt_ddb.h" 64#include "opt_ddb.h"
65#include "opt_kgdb.h" 65#include "opt_kgdb.h"
66#include "opt_modular.h" 66#include "opt_modular.h"
67#include "opt_useleds.h" 67#include "opt_useleds.h"
68 68
69#include <sys/param.h> 69#include <sys/param.h>
70#include <sys/systm.h> 70#include <sys/systm.h>
71#include <sys/signalvar.h> 71#include <sys/signalvar.h>
72#include <sys/kernel.h> 72#include <sys/kernel.h>
73#include <sys/proc.h> 73#include <sys/proc.h>
74#include <sys/buf.h> 74#include <sys/buf.h>
@@ -1405,26 +1405,28 @@ cpu_reboot(int howto, char *user_boot_st @@ -1405,26 +1405,28 @@ cpu_reboot(int howto, char *user_boot_st
1405 /* Make a crash dump. */ 1405 /* Make a crash dump. */
1406 if (howto & RB_DUMP) 1406 if (howto & RB_DUMP)
1407 dumpsys(); 1407 dumpsys();
1408 1408
1409 /* Run any shutdown hooks. */ 1409 /* Run any shutdown hooks. */
1410 doshutdownhooks(); 1410 doshutdownhooks();
1411 1411
1412 pmf_system_shutdown(boothowto); 1412 pmf_system_shutdown(boothowto);
1413 1413
1414 /* in case we came on powerfail interrupt */ 1414 /* in case we came on powerfail interrupt */
1415 if (cold_hook) 1415 if (cold_hook)
1416 (*cold_hook)(HPPA_COLD_COLD); 1416 (*cold_hook)(HPPA_COLD_COLD);
1417 1417
 1418 hppa_led_ctl(0xf, 0, 0);
 1419
1418 if (howto & RB_HALT) { 1420 if (howto & RB_HALT) {
1419 if ((howto & RB_POWERDOWN) == RB_POWERDOWN && cold_hook) { 1421 if ((howto & RB_POWERDOWN) == RB_POWERDOWN && cold_hook) {
1420 printf("Powering off..."); 1422 printf("Powering off...");
1421 DELAY(1000000); 1423 DELAY(1000000);
1422 (*cold_hook)(HPPA_COLD_OFF); 1424 (*cold_hook)(HPPA_COLD_OFF);
1423 DELAY(1000000); 1425 DELAY(1000000);
1424 } 1426 }
1425 1427
1426 printf("System halted!\n"); 1428 printf("System halted!\n");
1427 DELAY(1000000); 1429 DELAY(1000000);
1428 __asm volatile("stwas %0, 0(%1)" 1430 __asm volatile("stwas %0, 0(%1)"
1429 :: "r" (CMD_STOP), "r" (LBCAST_ADDR + iomod_command)); 1431 :: "r" (CMD_STOP), "r" (LBCAST_ADDR + iomod_command));
1430 } else { 1432 } else {