Thu Nov 5 20:40:22 2015 UTC ()
Pull up following revision(s) (requested by isaki in ticket #983):
	sys/arch/x68k/x68k/machdep.c: revision 1.192
To turn off the power, it's necessary to turn off the alarm signal
of RTC before writing the system port.  This is a fix for rev 1.191.
Thanks to Y.Sugahara.
Should be pulled up to netbsd-7.


(riz)
diff -r1.191 -r1.191.4.1 src/sys/arch/x68k/x68k/machdep.c

cvs diff -r1.191 -r1.191.4.1 src/sys/arch/x68k/x68k/machdep.c (expand / switch to unified diff)

--- src/sys/arch/x68k/x68k/machdep.c 2014/03/26 16:21:39 1.191
+++ src/sys/arch/x68k/x68k/machdep.c 2015/11/05 20:40:22 1.191.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $ */ 1/* $NetBSD: machdep.c,v 1.191.4.1 2015/11/05 20:40:22 riz Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 University of Utah. 4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1986, 1990, 1993 5 * Copyright (c) 1982, 1986, 1990, 1993
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer 9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department. 10 * Science Department.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * from: Utah $Hdr: machdep.c 1.74 92/12/20$ 36 * from: Utah $Hdr: machdep.c 1.74 92/12/20$
37 * 37 *
38 * @(#)machdep.c 8.10 (Berkeley) 4/20/94 38 * @(#)machdep.c 8.10 (Berkeley) 4/20/94
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191.4.1 2015/11/05 20:40:22 riz Exp $");
43 43
44#include "opt_ddb.h" 44#include "opt_ddb.h"
45#include "opt_kgdb.h" 45#include "opt_kgdb.h"
46#include "opt_compat_netbsd.h" 46#include "opt_compat_netbsd.h"
47#include "opt_fpu_emulate.h" 47#include "opt_fpu_emulate.h"
48#include "opt_m060sp.h" 48#include "opt_m060sp.h"
49#include "opt_modular.h" 49#include "opt_modular.h"
50#include "opt_panicbutton.h" 50#include "opt_panicbutton.h"
51#include "opt_extmem.h" 51#include "opt_extmem.h"
52#include "opt_m68k_arch.h" 52#include "opt_m68k_arch.h"
53 53
54#include <sys/param.h> 54#include <sys/param.h>
55#include <sys/systm.h> 55#include <sys/systm.h>
@@ -96,26 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v  @@ -96,26 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
96#include <machine/psl.h> 96#include <machine/psl.h>
97#include <machine/pte.h> 97#include <machine/pte.h>
98#include <machine/kcore.h> 98#include <machine/kcore.h>
99 99
100#include <dev/cons.h> 100#include <dev/cons.h>
101#include <dev/mm.h> 101#include <dev/mm.h>
102 102
103#define MAXMEM 64*1024 /* XXX - from cmap.h */ 103#define MAXMEM 64*1024 /* XXX - from cmap.h */
104#include <uvm/uvm.h> 104#include <uvm/uvm.h>
105 105
106#include <machine/bus.h> 106#include <machine/bus.h>
107#include <machine/autoconf.h> 107#include <machine/autoconf.h>
108#include <arch/x68k/dev/intiovar.h> 108#include <arch/x68k/dev/intiovar.h>
 109#include <arch/x68k/x68k/iodevice.h>
109 110
110extern void doboot(void) __attribute__((__noreturn__)); 111extern void doboot(void) __attribute__((__noreturn__));
111 112
112/* the following is used externally (sysctl_hw) */ 113/* the following is used externally (sysctl_hw) */
113char machine[] = MACHINE; /* from <machine/param.h> */ 114char machine[] = MACHINE; /* from <machine/param.h> */
114 115
115/* Our exported CPU info; we can have only one. */ 116/* Our exported CPU info; we can have only one. */
116struct cpu_info cpu_info_store; 117struct cpu_info cpu_info_store;
117 118
118struct vm_map *phys_map = NULL; 119struct vm_map *phys_map = NULL;
119 120
120extern paddr_t avail_start, avail_end; 121extern paddr_t avail_start, avail_end;
121extern u_int lowram; 122extern u_int lowram;
@@ -512,26 +513,30 @@ cpu_reboot(int howto, char *bootstr) @@ -512,26 +513,30 @@ cpu_reboot(int howto, char *bootstr)
512 * a1: the power switch is still on 513 * a1: the power switch is still on
513 * Power cannot be removed; simply halt the system (b) 514 * Power cannot be removed; simply halt the system (b)
514 * Power switch state is checked in shutdown hook 515 * Power switch state is checked in shutdown hook
515 * a2: the power switch is off 516 * a2: the power switch is off
516 * Remove the power 517 * Remove the power
517 * b) RB_HALT 518 * b) RB_HALT
518 * call cngetc 519 * call cngetc
519 * c) otherwise 520 * c) otherwise
520 * Reboot 521 * Reboot
521 */ 522 */
522 if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) { 523 if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) {
523 printf("powering off...\n"); 524 printf("powering off...\n");
524 delay(1000000); 525 delay(1000000);
 526
 527 /* Turn off the alarm signal of RTC */
 528 IODEVbase->io_rtc.bank0.reset = 0x0c;
 529
525 intio_set_sysport_powoff(0x00); 530 intio_set_sysport_powoff(0x00);
526 intio_set_sysport_powoff(0x0f); 531 intio_set_sysport_powoff(0x0f);
527 intio_set_sysport_powoff(0x0f); 532 intio_set_sysport_powoff(0x0f);
528 delay(1000000); 533 delay(1000000);
529 printf("WARNING: powerdown failed\n"); 534 printf("WARNING: powerdown failed\n");
530 delay(1000000); 535 delay(1000000);
531 /* PASSTHROUGH even if came back */ 536 /* PASSTHROUGH even if came back */
532 } else if ((howto & RB_HALT) == RB_HALT) { 537 } else if ((howto & RB_HALT) == RB_HALT) {
533 printf("System halted. Hit any key to reboot.\n\n"); 538 printf("System halted. Hit any key to reboot.\n\n");
534 (void)cngetc(); 539 (void)cngetc();
535 } 540 }
536 541
537 printf("rebooting...\n"); 542 printf("rebooting...\n");